-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Implement no-yank delete/change #1099
Conversation
helix-term/src/commands.rs
Outdated
delete_selection_noyank, "Delete selection (dont yank)", | ||
change_selection, "Change selection (delete and enter insert mode)", | ||
change_selection_noyank, "Change selection (delete and enter insert mode, dont yank)", |
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.
delete_selection_noyank, "Delete selection (dont yank)", | |
change_selection, "Change selection (delete and enter insert mode)", | |
change_selection_noyank, "Change selection (delete and enter insert mode, dont yank)", | |
delete_selection_noyank, "Delete selection (don't yank)", | |
change_selection, "Change selection (delete and enter insert mode)", | |
change_selection_noyank, "Change selection (delete and enter insert mode, don't yank)", |
Couldn't this have just been done by changing the |
Yes, and thats how i started doing it, but it felt like change and delete share a lot of the same code handling register, so i moved it to one central place (delete_selection_impl). Btw the test is failing because sometimes git clone related errors occur, like it happened now. |
helix-term/src/commands.rs
Outdated
// first yank the selection | ||
let values: Vec<String> = selection.fragments(text).map(Cow::into_owned).collect(); | ||
reg.write(values); | ||
if with_reg { |
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.
Let's make a "black hole" register '_'
. Then the extra parameter can be removed, and this condition can be if cx.register == Some('_')
. You can then explicitly set the register in the noyank
versions
helix-term/src/commands.rs
Outdated
delete_selection_noyank, "Delete selection (don't yank)", | ||
change_selection, "Change selection (delete and enter insert mode)", | ||
change_selection_noyank, "Change selection (delete and enter insert mode, don't yank)", |
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.
Let's instead use ", without yanking" for both of these.
https://github.com/mawww/kakoune/blob/master/src/normal.cc#L2236-L2239
dace94f
to
4c6ffe9
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.
🎉
Ah, looks like there's a conflict now, can you resolve it? Good to merge after that |
Done! |
(The black hole register needs to be added to https://docs.helix-editor.com/usage.html#special-registers) |
Black hole register is a special case for noyank versions of change and delete, so outside this they are still usable. |
Maybe that would be a good idea, because this might be confusing for users, a register behaving differently for only some functions. |
Yeah giving |
I wonder why not |
No description provided.