mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 11:04:35 +00:00
Fix Escape key handling for Kitty keyboard protocol
Add isEscape() helper that handles both raw (\x1b) and Kitty protocol (\x1b[27u) Escape sequences. Update all components that check for Escape key to use the new helper.
This commit is contained in:
parent
314ef34ebc
commit
f8b6164ecd
11 changed files with 38 additions and 18 deletions
|
|
@ -28,6 +28,7 @@ const CODEPOINTS = {
|
|||
w: 119,
|
||||
|
||||
// Special keys
|
||||
escape: 27,
|
||||
tab: 9,
|
||||
enter: 13,
|
||||
backspace: 127,
|
||||
|
|
@ -194,3 +195,12 @@ export function isAltBackspace(data: string): boolean {
|
|||
export function isShiftTab(data: string): boolean {
|
||||
return data === RAW.SHIFT_TAB || data === Keys.SHIFT_TAB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if input matches the Escape key (raw byte or Kitty protocol).
|
||||
* Raw: \x1b (single byte)
|
||||
* Kitty: \x1b[27u (codepoint 27 = escape)
|
||||
*/
|
||||
export function isEscape(data: string): boolean {
|
||||
return data === "\x1b" || data === `\x1b[${CODEPOINTS.escape}u`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue