(data: string)
| 1382 | } |
| 1383 | |
| 1384 | function decodeModifyOtherKeysPrintable(data: string): string | undefined { |
| 1385 | const parsed = parseModifyOtherKeysSequence(data); |
| 1386 | if (!parsed) return undefined; |
| 1387 | const modifier = parsed.modifier & ~LOCK_MASK; |
| 1388 | if ((modifier & ~MODIFIERS.shift) !== 0) return undefined; |
| 1389 | if (!Number.isFinite(parsed.codepoint) || parsed.codepoint < 32) return undefined; |
| 1390 | |
| 1391 | try { |
| 1392 | return String.fromCodePoint(parsed.codepoint); |
| 1393 | } catch { |
| 1394 | return undefined; |
| 1395 | } |
| 1396 | } |
| 1397 | |
| 1398 | export function decodePrintableKey(data: string): string | undefined { |
| 1399 | return decodeKittyPrintable(data) ?? decodeModifyOtherKeysPrintable(data); |
no test coverage detected