zed icon indicating copy to clipboard operation
zed copied to clipboard

Cannot unbind commands used in native menus on macOS

Open meguriau opened this issue 1 year ago • 5 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

Can not unbind a command by setting it to null.

  1. Paste the following setting in keymap.json
[
  {
    "context": "Editor && mode == full",
    "bindings": {
      "ctrl-g": null
    }
  }
]
  1. Press ctrl-g.

Environment

Zed: v0.122.1 (Zed Preview) OS: macOS 14.2.1 Memory: 32 GiB Architecture: x86_64

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

image

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

meguriau avatar Feb 08 '24 04:02 meguriau

Thanks for reporting this!

It looks like this is broken specifically in the case that the action is in the menu; because macOS triggers the key-binding for us.

This should be fixable, and if you'd like to pair on a fix, please book time here: https://calendly.com/conradirwin/pairing

ConradIrwin avatar Feb 08 '24 04:02 ConradIrwin

Can I help if I am not experienced in Rust?

failable avatar Feb 24 '24 00:02 failable

Absolutely! I think the problem stems from how our keybindings interact with the macOS key handler; so mostly this is going to be reading documentation and trying to figure out what to do. Happy to pair on it if you want: https://calendly.com/conradirwin/pairing

ConradIrwin avatar Feb 24 '24 02:02 ConradIrwin

Not sure if it's related. I trying to rebind cmd-a in the search bar

{
    "context": "BufferSearchBar",
    "bindings": {
      "cmd-a": "search::SelectAllMatches"
    }
}

But with the above config, cmd-a still "selects all the text in the input text field" instead of "selecting all the matches".


Updated:

Also

{
    "context": "Pane",
    "bindings": {
      "cmd-c": "search::ToggleCaseSensitive"
    }
}

does not work maybe due to "cmd-c" is some global key bindings for copy.

Yevgnen avatar Feb 29 '24 13:02 Yevgnen

Yup, it looks like this is also in the "Selection" menu.

ConradIrwin avatar Feb 29 '24 15:02 ConradIrwin

@meguriau Coming from Emacs too, find a temp fix for the specific ctrl-g issue using the recent send keystrokes feature

  {
    "context": "Editor",
    "bindings": {
      "ctrl-g": ["workspace::SendKeystrokes", "escape"],
      ...
   }
}

With this config, at least the annoying go to line box will not be shown up.

Yevgnen avatar Mar 08 '24 17:03 Yevgnen