Add stop_at_first_char
option to the move/select/delete to beginning of line actions
#25346
+166
−58
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.
Closes #7863
In order to make the behaviour of similarly named "[x] to beginning of line" actions consistent, I've added the
stop_at_first_char
option which, if enabled, will treat the first non-whitespace character as the start of the line, and otherwise will treat the first character (whitespace or otherwise) as the start. This option defaults to false, as based on my testing the default behaviour in VS Code, Vim, and Emacs is to use the "true" start of the line as opposed to the first non-whitespace character.This option essentially overrides the
stop_at_soft_wraps
option if enabled, as if themovement::indented_line_beginning
method is called with astop_at_soft_wraps
value of false, the actual line start will always be returned, rather than the indented line start. This feels somewhat counterintuitive, so if there's a better way I should be handling the case wherestop_at_soft_wraps
is false andstop_at_first_char
is true, I'd be happy to implement it.I've tried to be thorough with test cases, and I've included the new option in the default keymaps everywhere that the
stop_at_soft_wraps
option is specified, but it's entirely possible I've missed something, with this being my first contribution to the project. I'm always open to feedback and happy to pair.Release Notes:
stop_at_first_char
option to the move/select/delete to beginning of line actions