-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Jump to the next number on the line before incrementing #1778
Jump to the next number on the line before incrementing #1778
Conversation
5e47d0d
to
767f5f8
Compare
767f5f8
to
82ead06
Compare
helix-core/src/search.rs
Outdated
return None; | ||
} | ||
|
||
let mut chars = text.chars_at(pos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than a separate method that has to check for \n
& \r
, you could modify find_nth_prev
to use a matcher/pattern and pass in a text slice of a single line: text.line(n)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This made the function find_next_char_until_newline
a bit more complicated, though.
Any idea if I could have done it in a simpler way?
1fafef2
to
2cf6f35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay! I think this looks reasonable 👍
Hi, Edit: I found this later issue, but it's still not clear to me how to restore the vim-like behavior through custom keybindings. |
Thanks for the answer. I understand the argument "predictability and consistency by default", but to me it doesn't warrant removing useful functionality without a way to get it back through customization. I do think that macro keybindings would basically solve the problem, so it's good there is ongoing effort to that end (I really hope such a simple feature doesn't end up requiring custom scripting though). |
As you say the reason is predictability and consistency. That's much more important to me than emulating vim. Increment/decrement behave unpredictably when we try to guess what number we're on or is nearby, especially when you have multiple cursors. Helix's editing model is to operate on selections and increment/decrement shouldn't be any exception. I won't accept a config flag for this behavior - the proper way to reintroduce this is macro keybindings and scripting. |
Partially fix #1645
I noted that there's a bug that already exists in the current implementation regarding the selection being moved when the text length of a number is changed by incrementing/decrementing (when adding/removing a digit).