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