* Build a ParsedKeystroke from Ink's input/key.
(input: string, key: Key)
| 80 | * Build a ParsedKeystroke from Ink's input/key. |
| 81 | */ |
| 82 | function buildKeystroke(input: string, key: Key): ParsedKeystroke | null { |
| 83 | const keyName = getKeyName(input, key) |
| 84 | if (!keyName) return null |
| 85 | |
| 86 | // QUIRK: Ink sets key.meta=true when escape is pressed (see input-event.ts). |
| 87 | // This is legacy terminal behavior - we should NOT record this as a modifier |
| 88 | // for the escape key itself, otherwise chord matching will fail. |
| 89 | const effectiveMeta = key.escape ? false : key.meta |
| 90 | |
| 91 | return { |
| 92 | key: keyName, |
| 93 | ctrl: key.ctrl, |
| 94 | alt: effectiveMeta, |
| 95 | shift: key.shift, |
| 96 | meta: effectiveMeta, |
| 97 | super: key.super, |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Compare two ParsedKeystrokes for equality. Collapses alt/meta into |
no test coverage detected