fix(tui): parse legacy alt-prefixed symbols (#6523)

This commit is contained in:
Rafał Krzyważnia
2026-07-11 15:20:08 +02:00
committed by GitHub
parent 5416b1834a
commit 8479bd8474
2 changed files with 14 additions and 5 deletions
+6 -5
View File
@@ -1159,8 +1159,8 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
if (data === `\x1b${rawCtrl}`) return true;
}
if (modifier === MODIFIERS.alt && !_kittyProtocolActive && (isLetter || isDigit)) {
// Legacy: alt+letter/digit is ESC followed by the key
if (modifier === MODIFIERS.alt && !_kittyProtocolActive && (isLetter || isDigit || SYMBOL_KEYS.has(key))) {
// Legacy: alt+printable key is ESC followed by the key
if (data === `\x1b${key}`) return true;
}
@@ -1296,9 +1296,10 @@ export function parseKey(data: string): string | undefined {
if (code >= 1 && code <= 26) {
return `ctrl+alt+${String.fromCharCode(code + 96)}`;
}
// Legacy alt+letter/digit (ESC followed by the key)
if ((code >= 97 && code <= 122) || (code >= 48 && code <= 57)) {
return `alt+${String.fromCharCode(code)}`;
// Legacy alt+letter/digit/symbol (ESC followed by the key)
const key = String.fromCharCode(code);
if ((code >= 97 && code <= 122) || (code >= 48 && code <= 57) || SYMBOL_KEYS.has(key)) {
return `alt+${key}`;
}
}
if (data === "\x1b[A") return "up";