fix(tui): parse legacy alt-prefixed symbols (#6523)
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user