Add option to configure word separators while editing in the console. #2978
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ISSUE TYPE
RUNTIME ENVIRONMENT
CHECKLIST
CONTRIBUTING
document has been read [REQUIRED]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__
andcheck_messages
are no longer supposed to be used (and they are used intests/pylint/python3.py
).However, if I run the tests with
pylint<3.0.0
(by doingpipx 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 asseparators
).IMAGES / VIDEOS