Repository navigation
feat(terminal): start phones in direct typing - #1163
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
…tead of sending each jamo (#1327) ## Summary In direct typing (the default on phones since #1163), an iPhone's on-screen Korean keyboard sent each jamo to the pane on its own: 한글 arrived as `ㅎㅏㄴㄱㅡㄹ`, and after English as `abcㅎㅏㄴㄱㅡㄹ`. Found while testing #432 on WebKit. #432 itself is macOS Safari; this is the iPhone counterpart of the same family (Hangul breaking in the terminal on Apple WebKit), so this PR is `Refs #432`, not a fix for it. Root cause, from events logged in a plain textarea on the same keyboard: the iPhone keyboard sends each jamo as a `keydown` with `keyCode` 0 and the jamo as `key`, then edits the field with `deleteContentBackward` + `insertText` and **no composition events**. That is the sequence the iPad hardware keyboard sends, which #938 handles in the xterm patch (`CompositionHelper.passHangulKey` / `beforeinput`), but that path was gated to `isMac || isIpad`. On an iPhone, xterm sent the jamo on keydown and cancelled the editor's edit. The fix adds `isIphone` (xterm's own `navigator.platform === 'iPhone'`) to both gates. Nothing else in the patch changes. Design reference: the editor-composes, terminal-commits-on-next-key model is the one #938 already uses for iPadOS; no new mechanism. ## Verification - iOS 27.0 simulator (iPhone 18 Pro), Safari, on-screen Korean 2-set keyboard tapped with AXe, owned raw-mode PTY in an isolated herdr test session. Bytes received by the PTY: | Typed | main | this PR | | --- | --- | --- | | 한글 Space | `ㅎ ㅏ ㄴ ㄱ ㅡ ㄹ ␠` | `한 글 ␠` | | abc, switch to 한국어, 한글 Space | `a b c ㅎ ㅏ ㄴ ㄱ ㅡ ㄹ ␠` | `a b c 한 글␠` | | 한 ⌫ Space | | `하␠` | | 한 ⌫⌫⌫⌫ Space | | `DEL ␠` (three edit the syllable, the fourth deletes in the pane) | | ㄱㅏㅂㅅㅏ Space (final consonant moves on) | | `갑사 ␠` | | 한 Enter | | `한\r` | | 한 Space, then hold ⌫ 3 s | | `한 ␠` + 23 DEL (with #1325) | - `scripts/terminal-ipad-ime-regression.ts` now also replays the trace under an iPhone user agent and `navigator.platform = "iPhone"` with `keyCode` 0 (in its own context, so #1325's kept space is active too). Without the patch change it fails with `actual: "abcㅎㅏㄴ"`; with it, MacIntel, iPad and iPhone pass. - Patch regenerated with `bun patch --commit` (the stray `.bun-tag` entry it adds was removed) and checked with a clean `bun install --frozen-lockfile`. - `bun run check fast` passes. ## Limits - Simulator only; Chrome for iOS (same WebKit, `CriOS` user agent, which xterm's `isSafari` accepts) could not be installed in it. - The iPad simulator's on-screen keyboard already composed correctly (`abc한글 `), and its hardware-keyboard path is untouched. - #432 (macOS Safari, physical Korean IME) could not be driven natively from this setup: synthetic keystrokes need an Accessibility grant and safaridriver needs remote automation enabled (admin), neither available over SSH. So #432 stays open. Refs #432 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
A phone's terminal now starts in direct typing, like a desktop. "Automatic" (the default terminal input mode) types straight into the grid on every device; the key bar's keyboard button or Settings → Terminal → Terminal input mode still switches to the input line, and that choice is remembered on the device.
PaneTerminal.tsx:directTypingisterminalInputMode !== "line"; the legacyherdr-web-ui:direct-typinglocalStorage fallback is gone (a toggle already writesterminalInputMode).Docs (
docs/terminal-input.md,docs/guide.md) and a changelog fragment.Browser scripts:
ui-regression.tsnow asserts a phone starts in direct typing, then switches to the line;mobile-viewport-regression.tsandwindows-lens-browser-qa.tsseedterminalInputMode: "line", since their walks start from the input line.Settings → Terminal input mode offers Direct typing and Input line: "Automatic" became the same as Direct typing, so the select shows the stored
autodefault as Direct typing and the three now-unused "Automatic" translations are removed. Stored values are unchanged.Verification
bun run typecheckpasses;bun run test:unit: 3800 pass, 0 fail.line; reload keeps the line; tapping again returns to direct typing.bun run check full: two failures that reproduce identically on unmodifiedmain(30eb47e) on this PC —terminal-command-backspace-regression("non-macOS Meta+Backspace keeps its native sequence", extra DECRQM/DA replies captured) andapi.contract.test.ts"applies a resize that arrives while a covered attach is still creating the pty". The ui-regression touch section is after the first one, so CI's browser lane is its first full run.