-
-
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
Update file change history before calling MappableCommand #4780
Conversation
Alternatively, keybinds that call typable commands from insert-mode could include |
I meant that it could be done in keymaps: [keys.insert]
C-s = ["commit_undo_checkpoint", ":w"] but I suppose there isn't really a downside to doing this for all typable commands. Mostly this will just be a no-op since you need to enter normal/select modes to execute typable commands and that also saves a checkpoint |
This breaks how the undo is supposed to work though, we've had this issue & PR before: #2883 (review) #3501 |
I think this needs some discussion but maybe having the undo state broken into two undo steps is preferable to having this broken. |
helix-term/src/commands.rs
Outdated
@@ -167,6 +167,7 @@ impl MappableCommand { | |||
Self::Typable { name, args, doc: _ } => { | |||
let args: Vec<Cow<str>> = args.iter().map(Cow::from).collect(); | |||
if let Some(command) = typed::TYPABLE_COMMAND_MAP.get(name.as_str()) { | |||
commit_undo_checkpoint(cx); |
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.
Should only be called if in insert mode, together with a comment explaining why this is needed in the first place
I don't think this is the right solution to the problem. Some commands are fine to call from insertmode with creating a checkpoint. These commands should not be changed to create a checkpoint. closing this one out as stale, thank you for contributing! |
Before we run a mappable command we should update the current changes to history.
This fixes #4719