fix(core): normalize embedded terminal keys (#1423)
## Summary - reject parser escape codes such as `[A` and `[27u` as physical key identifiers - infer Web-style physical identities (`ArrowUp`, `KeyC`, `Digit1`, `Escape`) before calling Ghostty - derive the unshifted codepoint from that normalized physical identity - cover raw arrow input and nested Kitty character/escape re-encoding ## Why this is needed OpenTUI key events use `code` for two different kinds of values. Kitty and raw escape parsing can produce parser codes such as `[A` for Up or `[27u` for Kitty Escape, while other events provide Web-style physical codes such as `KeyA`. Ghostty's key encoder accepts the latter physical identities, not parser escape fragments. Passing `[A` through as the physical key leaves Ghostty unable to encode an arrow key. Embedded terminals also need to re-encode input when the program inside them enables the Kitty keyboard protocol. In that mode, text alone is insufficient for modified and disambiguated keys: Ghostty needs a normalized physical identity and its unshifted codepoint. Raw character events may not include `code`, so this change infers `KeyA`/`Digit1`; Kitty escape events whose parser code is `[27u` fall back to `Escape`. The regression verifies that Ctrl+C and Escape are re-emitted as Kitty sequences for a nested terminal. ## Testing - `bun test src/renderables/EmbeddedTerminal.test.ts` (16 passed) - `oxlint packages/core/src/renderables/EmbeddedTerminal.ts packages/core/src/renderables/EmbeddedTerminal.test.ts` - `oxfmt --check packages/core/src/renderables/EmbeddedTerminal.ts packages/core/src/renderables/EmbeddedTerminal.test.ts`
J
James Long committed
247199db66e7b8c79c19ba9d62afa05b494eb5f0
Parent: 21b0021
Committed by GitHub <noreply@github.com>
on 8/24/2026, 5:27:33 PM