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
42.43k stars 2.24k forks source link

search::toggleReplace unavailable in 'editor' context, keymap override ignored #10953

Open xezrunner opened 3 months ago

xezrunner commented 3 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Trying to override ctrl-h in the user keymap to search:toggleReplace results in no effect during editing and continues firing the default action instead.

The default keymap has ctrl-h bound to editor::Backspace, which is the action that is being performed in place of the user override.

Environment

Zed: v0.133.0 (Zed Preview)
OS: macOS 14.5.0
Memory: 8 GiB
Architecture: aarch64

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

Screen recording:

https://github.com/zed-industries/zed/assets/8061077/2843b74b-686c-4428-b56e-af87aca32723

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

Logs contain no information related to this.

alexander-irbis commented 3 months ago

Regarding this case, I tried assigning the command to open the last project to ctrl-h, and it works perfectly. However, when I assigned "search::ToggleReplace" to ctrl-h, it started acting like Backspace, deleting the character to the left.

I suspect it works as follows: the editor cannot execute the action because it is not available in the current context, and as a fallback, it tries to find another key reassignment higher up in the reassignment tree, instead of stopping the search for an alternative possible action.

alexander-irbis commented 3 months ago

To add for accuracy, in my ABC layout, when the search panel is open, the ctrl-h override works as expected, toggling the panel to replace mode. When the search panel is closed, it acts like Backspace.

xezrunner commented 3 months ago

Regarding this case, I tried assigning the command to open the last project to ctrl-h, and it works perfectly. However, when I assigned "search::ToggleReplace" to ctrl-h, it started acting like Backspace, deleting the character to the left.

I suspect it works as follows: the editor cannot execute the action because it is not available in the current context, and as a fallback, it tries to find another key reassignment higher up in the reassignment tree, instead of stopping the search for an alternative possible action.

Thanks for the additional info, updated the issue title and description to better reflect the problem.