Skip to content
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

Undoing change in insert mode does nothing when first opening the file #2409

Closed
joezak11 opened this issue May 5, 2022 · 3 comments
Closed
Labels
C-bug Category: This is a bug

Comments

@joezak11
Copy link
Contributor

joezak11 commented May 5, 2022

Summary

using the following configuration

[keys.insert]
C-z = "undo"

editing a file without going to normal mode prints Already at oldest change if I go to normal mode and go back to insert mode I can undo

Reproduction Steps

I tried this:

  1. hx
  2. enter insert mode
  3. type anything
  4. press Ctrl-z

I expected this to happen:
to undo the changes
Instead, this happened:
I get Already at oldest change

Helix log

No response

Platform

Linux

Terminal Emulator

alacritty 0.8.0-dev (3ed0430)

Helix Version

helix 22.05-dev (fc61796)

@joezak11 joezak11 added the C-bug Category: This is a bug label May 5, 2022
@the-mikedavis
Copy link
Member

the-mikedavis commented May 5, 2022

This is expected behavior. In order to undo, helix needs an undo checkpoint. These are saved automatically by switching from insert to normal mode. There was a new command merged recently that alllows you to save a checkpoint manually in insert mode: #2115 (bound to C-s by default)

@joezak11
Copy link
Contributor Author

joezak11 commented May 5, 2022

I see. Are there any plans for changing that behavior? neovim works as expected, I'm not sure how they implement it, though. could be time based or event based with a debounse or something.

@the-mikedavis
Copy link
Member

There's been some discussion about more granular or automatic undo checkpoints in insert mode based on a timeout or a number of words typed but many of us agree that it's better to be explicit about the checkpoints (i.e. use C-s or switch to normal mode) or else you end up having to hit u (or C-z in this case) an unpredictable number of times to go back to the last explicit checkpoint.

See #1583 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants