zed icon indicating copy to clipboard operation
zed copied to clipboard

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

Open xezrunner opened this issue 1 year ago • 3 comments

Check for existing issues

  • [X] Completed

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.

xezrunner avatar Apr 24 '24 21:04 xezrunner

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 avatar Apr 26 '24 12:04 alexander-irbis

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.

alexander-irbis avatar Apr 26 '24 12:04 alexander-irbis

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.

xezrunner avatar Apr 26 '24 13:04 xezrunner