mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 19:05:11 +00:00
With the Kitty keyboard protocol (flag 4), terminals report both the logical key codepoint and the physical base layout key (PC-101 QWERTY position). The key matching logic in matchesKittySequence matched against both unconditionally, which caused a single keypress to match multiple shortcuts on remapped keyboard layouts. For example, on a Dvorak layout with xremap, pressing Ctrl+K sends CSI 107::118;5u (codepoint=107 'k', base layout=118 'v'). The unconditional base layout match made this also match Ctrl+V, which is bound to pasteImage. Since CustomEditor checks app-level keybindings (pasteImage) before editor keybindings (deleteToLineEnd), Ctrl+K was silently intercepted by the paste image handler instead of deleting to end of line. The same issue affects symbol keys, as Dvorak also remaps symbols to different physical positions (e.g., '/' sits where '[' is on QWERTY). The fix restricts base layout key matching to cases where the codepoint is not a recognized Latin letter (a-z) or symbol (/, -, [, ;, etc.). When the codepoint is already a recognized key, it is authoritative and the base layout key is ignored. This preserves non-Latin layout support (Ctrl+К on a Russian layout still matches Ctrl+K via base layout key 107) while preventing false matches from differing physical key positions on remapped layouts. Both matchesKittySequence and parseKey are updated with the same logic. |
||
|---|---|---|
| .. | ||
| components | ||
| autocomplete.ts | ||
| editor-component.ts | ||
| fuzzy.ts | ||
| index.ts | ||
| keybindings.ts | ||
| keys.ts | ||
| stdin-buffer.ts | ||
| terminal-image.ts | ||
| terminal.ts | ||
| tui.ts | ||
| utils.ts | ||