gpui: Fix keystroke interception for standalone modifiers (#64537)
I ran into this while working on keybindings for the pending-keystrokes
indicator. Keystroke interceptors never received standalone modifiers.
GPUI recognizes a standalone modifier on release through a
`ModifiersChangedEvent`. But interception only handled `KeyDownEvent`s,
so the stroke went straight to keymap dispatch. This change passes the
recognized keystroke to interceptors instead of checking the raw event
type.
1. Recording standalone modifiers
With this binding in `keymap.json`, start recording a binding, then
press and release Shift:
```json
[
{
"bindings": {
"shift": "command_palette::Toggle"
}
}
]
```
- Before, the command palette opens and Shift is not recorded.
- After, the recorder captures `shift` without opening the command
palette.
2. Searching for standalone modifiers
With these bindings, enable keystroke search, turn exact matching off,
then press and release Control:
```json
[
{
"context": "Editor",
"bindings": {
"ctrl": "command_palette::Toggle",
"ctrl-k": "command_palette::Toggle"
}
}
]
```
- Before, holding Control finds Ctrl-K but not Control alone. Releasing
Control clears the modifier query.
- After, releasing Control records it as a standalone key, and non-exact
search finds both Ctrl-K and Control alone.
Release Notes:
- Fixed recording and searching for standalone modifier-key bindings in
the keymap editor.
- [GPUI] Fixed keystroke interceptors to receive standalone modifier
keystrokes.
ba42ab9d98Smit Barmase committed on 9/23/2026, 3:59:20 AM· committed by GitHubparent5299a14