zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
48.8k stars 2.93k forks source link

cmd+escape replays last command, and isn't able to be disabled #6836

Open MikeShi42 opened 9 months ago

MikeShi42 commented 9 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Using vim keybindings enabled (I've seen it happen without vim, but harder to repro?)

  1. Open a new file
  2. Go into insert mode
  3. Type in something, ex. "hello"
  4. Escape
  5. Cmd+S to save
  6. Press Cmd+Esc
  7. Observe text has duplicated (my editor now says hellhelloo)

Environment

Zed: v0.119.19 (Zed) OS: macOS 13.3.0 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

djrenren commented 2 months ago

Confirmed this is driving me nuts. I didn't realize how often I accidentally typed cmd-esc until now.

Cammisuli commented 1 month ago

This also is driving me nuts. I couldn't figure out what which command/key combo was doing it. Thanks for pointing it out!

As a workaround, I just changed that binding with BetterTouchTool to just act as esc all the time until we can change the binding in the zed keymap.

image
MikeShi42 commented 1 month ago

@Cammisuli that's brilliant, for some reason I never thought of that - this was a huge bug that stopped me from trying to migrate over to Zed within the first few minutes of using it but now maybe I finally can with the remap :)

For context for maintainers (@JosephTLyons ?): I realized I typed up this issue really quickly and it seems like a pretty random bug, for me it was a show stopping issue because I frequently use the sequence cmd+s (save) and then after enter command mode (esc) while coding. Usually I do the combo pretty quickly and end up having some overlap between them - leading to this issue (leading to unintentional code deletions and all sorts of other wacky behavior that was concerning to see from an editor!). I imagine anyone else with a habit of doing some sort of cmd hotkey and then quickly trying to enter command mode after will also trigger this issue. Just in case this context helps with prioritization

Stephen-Campbell1 commented 3 weeks ago

I commented out this section and am no longer able to reproduce the issue. Given that this snippet was put in to address another bug, I'm not sure what the long-term fix is.