gpui: Only time out multi-stroke bindings when current prefix matches#42659
gpui: Only time out multi-stroke bindings when current prefix matches#42659ConradIrwin merged 5 commits intozed-industries:mainfrom
Conversation
|
A few comments to be considered:
cc. |
94cc6ce to
46ea86f
Compare
|
There is one integration test |
|
Thanks for this! I'm worried about this condition: because I think keys like |
keystroke.key_char for text input
|
Yes, thank you for correcting me. I think you are right. I was missing the default functionalities for typing I removed that filter in the new commit and I noticed there is minor difference when you type Screen.Recording.2025-11-20.at.7.30.08.AM.movAs you can see, normally we will have a pending effect for the input text when we didn't enter the next |
|
Okay, I found the root cause for this inconsistent behavior. Since As a result, we need to change the pending text/highlight respecting any keystroke that produces a |
|
Great, thank you! |
…zed-industries#42659) Part One for Resolving zed-industries#10910 ### Summary Typing prefix (partial keybinding) will behave like Vim. No timeout until you either finish the sequence or hit Escape, while ambiguous sequences still auto-resolve after 1s. ### Description This follow-up tweaks the which-key system first part groundwork so our timeout behavior matches Vim’s expectations. Then we can implement the UI part in the next step (reference latest comments in zed-industries#34798) - `DispatchResult` now reports when the current keystrokes are already a complete binding in the active context stack (`pending_has_binding`). We only start the 1s flush timer in that case. Pure prefixes or sequences that only match in other contexts—stay pending indefinitely, so leader-style combos like `space f g` no longer evaporate after a second. - `Window::dispatch_key_event` cancels any prior timer before scheduling a new one and only spawns the background flush task when `pending_has_binding` is true. If there’s no matching binding, we keep the pending keystrokes and rely on an explicit Escape or more typing to resolve them. Release Notes: - Fixed multi-stroke keybindings so only ambiguous prefixes auto-trigger after 1 s; unmatched prefixes now stay pending until canceled, matching Vim-style leader behavior.
Closes #10910 Follow up work continuing from the last PR #42659. Add the UI element for displaying vim like which-key menu. https://github.com/user-attachments/assets/3dc5f0c9-5a2f-459e-a3db-859169aeba26 Release Notes: - Added a which-key like modal with a compact, single-column panel anchored to the bottom-right. You can enable with `{"which_key": {"enabled": true}}` in your settings. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Closes #10910 Follow up work continuing from the last PR #42659. Add the UI element for displaying vim like which-key menu. https://github.com/user-attachments/assets/3dc5f0c9-5a2f-459e-a3db-859169aeba26 Release Notes: - Added a which-key like modal with a compact, single-column panel anchored to the bottom-right. You can enable with `{"which_key": {"enabled": true}}` in your settings. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Closes #10910 Follow up work continuing from the last PR #42659. Add the UI element for displaying vim like which-key menu. https://github.com/user-attachments/assets/3dc5f0c9-5a2f-459e-a3db-859169aeba26 Release Notes: - Added a which-key like modal with a compact, single-column panel anchored to the bottom-right. You can enable with `{"which_key": {"enabled": true}}` in your settings. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Closes zed-industries#10910 Follow up work continuing from the last PR zed-industries#42659. Add the UI element for displaying vim like which-key menu. https://github.com/user-attachments/assets/3dc5f0c9-5a2f-459e-a3db-859169aeba26 Release Notes: - Added a which-key like modal with a compact, single-column panel anchored to the bottom-right. You can enable with `{"which_key": {"enabled": true}}` in your settings. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Closes zed-industries#10910 Follow up work continuing from the last PR zed-industries#42659. Add the UI element for displaying vim like which-key menu. https://github.com/user-attachments/assets/3dc5f0c9-5a2f-459e-a3db-859169aeba26 Release Notes: - Added a which-key like modal with a compact, single-column panel anchored to the bottom-right. You can enable with `{"which_key": {"enabled": true}}` in your settings. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Closes zed-industries#10910 Follow up work continuing from the last PR zed-industries#42659. Add the UI element for displaying vim like which-key menu. https://github.com/user-attachments/assets/3dc5f0c9-5a2f-459e-a3db-859169aeba26 Release Notes: - Added a which-key like modal with a compact, single-column panel anchored to the bottom-right. You can enable with `{"which_key": {"enabled": true}}` in your settings. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Part One for Resolving #10910
Summary
Typing prefix (partial keybinding) will behave like Vim. No timeout until you either finish the sequence or hit Escape, while ambiguous sequences still auto-resolve after 1s.
Description
This follow-up tweaks the which-key system first part groundwork so our timeout behavior matches Vim’s expectations. Then we can implement the UI part in the next step (reference latest comments in #34798)
DispatchResultnow reports when the current keystrokes are already a complete binding in the active context stack (pending_has_binding). We only start the 1s flush timer in that case. Pure prefixes or sequences that only match in other contexts—stay pending indefinitely, so leader-style combos likespace f gno longer evaporate after a second.Window::dispatch_key_eventcancels any prior timer before scheduling a new one and only spawns the background flush task whenpending_has_bindingis true. If there’s no matching binding, we keep the pending keystrokes and rely on an explicit Escape or more typing to resolve them.Release Notes:
cmd-k cmd-s, org din vim mode) will no-longer time out waiting for input. Before this change Zed would wait at most 1s for the second keystroke. In the case where the start of the multi-stroke binding is itself a valid key action (or input text) then the 1s timeout will still apply.