Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to configure word separators while editing in the console. #2978

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jojhelfer
Copy link

@jojhelfer jojhelfer commented May 24, 2024

ISSUE TYPE

  • Improvement/feature implementation

RUNTIME ENVIRONMENT

  • Operating system and version: Ubuntu 22.04.4 LTS
  • Terminal emulator and version: Gnome Terminal Version 3.44.0 for GNOME 42
  • Python version: 3.10.12
  • Ranger version/commit: ranger-master 38bb890
  • Locale: en_us

CHECKLIST

  • The CONTRIBUTING document has been read [REQUIRED]
  • All changes follow the code style [REQUIRED]
  • All new and existing tests pass [REQUIRED]
  • Changes require config files to be updated
    • Config files have been updated
  • Changes require documentation to be updated
    • Documentation has been updated
  • Changes require tests to be updated
    • Tests have been updated

DESCRIPTION

This adds a configuration option console_word_separators to allow characters other than spaces to be considered as word separators when using (by default) <a-b> and <a-f> to move between words in the console.

A typical value for this setting might be "_-.", but I left the default value as "", so as not to break compatibility.

I also would have preferred if this option has all characters which are separators (rather than all characters besides space), but that would require the default value to be " ", which seems to be impossible with the current config parser.

MOTIVATION AND CONTEXT

Often filenames have hyphens and underscores rather than spaces as word separators, and it is nice to be able to move between words in a filename.

TESTING

The tests fail for me even before making the changes in this commit. It seems to be a problem related to the version of pylint. According to this, __implements__ and check_messages are no longer supposed to be used (and they are used in tests/pylint/python3.py).

However, if I run the tests with pylint<3.0.0 (by doing pipx install 'pylint<3.0.0', pipx inject pylint pytest, pipx install pytest, pipx inject pytest 'pylint<3.0.0'), then the tests run successfully.

I also added some new tests in the docstring for move_by_word -- however, they are a bit arbitrary, and don't test al possible uses of the function (for example, if a string of length >1 is passed as separators).

IMAGES / VIDEOS

@jojhelfer jojhelfer force-pushed the master branch 2 times, most recently from 9e5b5a8 to ea8f7e5 Compare May 25, 2024 00:09
@DanilaBerezin
Copy link

DanilaBerezin commented May 27, 2024

Unrelated question: judging by your post's edit history, it looks like you had an issue running make and make test due to this issue, but then it seems you somehow fixed it. How did you fix that issue? Running into the exact same thing.

@jojhelfer
Copy link
Author

Unrelated question: judging by your post's edit history, it looks like you had an issue running make and make test due to this issue, but then it seems you somehow fixed it. How did you fix that issue? Running into the exact same thing.

Ah, good question. That was also to do with the pylint version; see here.
I had been using the pylint package on Ubuntu 22.04, which is pylint version 2.12, but apparently the issue involving W1601 was resolved only in version 2.13.

So, when I installed pylint with pipx, giving me the latest version 3.2.2, it resolved that issue, but then it created the above-mentioned incompatibility with ranger's tests, for which I need version <3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants