fix(terminal): correct key-bar wire encoding, breakpoint and safe area
Review fixes on top of the mobile virtual key bar.
Encoding (lib/terminal/keybar.ts):
- Honor DECCKM. Unmodified arrows / Home / End were hard-coded to the
CSI form (ESC [ A), but xterm.js switches to SS3 (ESC O A) whenever
the application-cursor-keys mode is set — which is exactly what vim,
htop and anything else calling smkx do. Those programs match the
terminfo capability, so a fixed ESC [ A arrives as three separate
keys. termKeySeq now takes the mode and pressKey reads it off
term.modes.applicationCursorKeysMode.
- Widen the CTRL latch beyond a-z. 0x40-0x5f now maps to code-0x40, so
Ctrl+[ is ESC, Ctrl+\ is SIGQUIT and Ctrl+_ is undo instead of the
literal character with the latch silently eaten; space maps to NUL
and ? to DEL. CTRL and ALT also compose (ESC + control byte) rather
than the first winning, so the encoder no longer depends on the UI
keeping the two latches mutually exclusive.
Wiring:
- Use useIsMobile() in terminal-panel instead of a second, differently
valued breakpoint. The shell picks its mobile layout at max-width
767px; the panel asked for 768px, so a window exactly 768px wide got
the mobile key bar inside the desktop shell.
- Subtract env(safe-area-inset-bottom) from the key-bar column while
the soft keyboard is down. The terminal Drawer portals to the body
and so never inherits the mobile shell's safe-area padding, which
left the bottom button row sitting under the home indicator. With
the keyboard up, kbdLift already clears it.
Also: hyphen key was labelled with an em dash in all 10 locales while it
types "-"; keyboard toggle uses the lucide icon rather than a bare glyph
and carries an accessible name; drop the JSX IIFE and the comments
pointing at a project and a function that do not exist in this repo.
Tests: 7 new keybar cases for the above, plus terminal-panel.test.tsx
covering the mobile gate and the persisted collapse flag.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> X
xintaofei committed
1f3b1b9a3cd3b48ecc4b85c7ae16759fa4689dc1
Parent: bde2aec