pub struct KeyChord {
pub key: Key,
pub mods: Mods,
}Expand description
A key plus its modifiers — the unit a keymap binds to a crate::Command.
Fields§
§key: Key§mods: ModsImplementations§
Source§impl KeyChord
impl KeyChord
Sourcepub fn is_terminal_ambiguous(&self) -> bool
pub fn is_terminal_ambiguous(&self) -> bool
Whether a legacy terminal can even deliver this chord distinguishably.
Without the kitty keyboard protocol — which we do not enable — Ctrl+<key> is
sent as the control byte key & 0x1f, and several of those bytes are already
spoken for by named keys or by each other:
| chord | byte | indistinguishable from |
|---|---|---|
Ctrl+I | 0x09 | Tab |
Ctrl+M | 0x0D | Enter |
Ctrl+J | 0x0A | Enter (line feed) |
Ctrl+H | 0x08 | Backspace |
Ctrl+[ | 0x1B | Esc |
Ctrl+` | 0x00 | Ctrl+@, Ctrl+Space (NUL) |
Ctrl+@ | 0x00 | Ctrl+` , Ctrl+Space |
Ctrl+Space | 0x00 | Ctrl+` , Ctrl+@ |
Ctrl+Shift+letter | same control byte as Ctrl+letter | shift is lost |
The NUL family is worse than merely ambiguous: most emulators decline to send
anything at all for Ctrl+` , and macOS claims Ctrl+Space for input-source
switching before any terminal sees it. Neither is reachable in practice.
Binding one of these does not fail loudly — it silently does whatever the other key is bound to, or nothing, which is indistinguishable from the feature being broken. So the default keymap is tested against this rather than trusted.