Skip to content

feat(terminal): start phones in direct typing - #1163

Merged
devswha merged 3 commits into
mainfrom
feat/mobile-direct-typing-default
Oct 15, 2026
Merged

devswha merged 3 commits into
mainfrom
feat/mobile-direct-typing-default

Conversation

@devswha

@devswha devswha commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

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: directTyping is terminalInputMode !== "line"; the legacy herdr-web-ui:direct-typing localStorage fallback is gone (a toggle already writes terminalInputMode).

  • Docs (docs/terminal-input.md, docs/guide.md) and a changelog fragment.

  • Browser scripts: ui-regression.ts now asserts a phone starts in direct typing, then switches to the line; mobile-viewport-regression.ts and windows-lens-browser-qa.ts seed terminalInputMode: "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 auto default as Direct typing and the three now-unused "Automatic" translations are removed. Stored values are unchanged.

Verification

  • bun run typecheck passes; bun run test:unit: 3800 pass, 0 fail.
  • Demo build at 390×844 (touch): a fresh phone shows the keyboard key armed and no input line; tapping it shows the line and stores line; reload keeps the line; tapping again returns to direct typing.
  • Local bun run check full: two failures that reproduce identically on unmodified main (30eb47e) on this PC — terminal-command-backspace-regression ("non-macOS Meta+Backspace keeps its native sequence", extra DECRQM/DA replies captured) and api.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.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 38101d74-320c-49d8-9e21-52f320642df9
📥 Commits

Reviewing files that changed from the base of the PR and between 51b8e52 and 9ba30c1.

📒 Files selected for processing: 2
  • docs/guide.md
  • scripts/ui-regression.ts
🚧 Files skipped from review as they are similar to previous changes: 1
  • docs/guide.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Updates
    • Terminals now default to direct typing on phones as well as desktop, sending keystrokes straight to the terminal.
    • On touch screens, the keyboard button switches between direct typing and the input line. Desktop users can change modes in Settings.
    • The Terminal input mode setting now offers Direct typing and Input line; Automatic is no longer available.

Terminal input now defaults to direct typing on phones and other devices. The settings selector offers Direct typing and Input line. Documentation and regression checks reflect the updated modes.

Changes: Terminal Input Mode

Layer / File(s) Summary
Input mode selection
src/components/SettingsDialog.tsx, src/components/PaneTerminal.tsx, docs/terminal-input.md, docs/guide.md, changelog.d/phone-direct-typing-default.md, src/lib/i18n.*.ts
The selector now stores only line or direct. PaneTerminal uses direct typing unless the mode is line. Documentation and translations reflect the removed Automatic option and phone behavior.
Regression setup and checks
scripts/ui-regression.ts, scripts/mobile-viewport-regression.ts, scripts/windows-lens-browser-qa.ts
UI regression checks verify the touch terminal’s direct-typing default and switch to the input line. The mobile viewport and attached-browser setups select line mode.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: jiunshinn

Merge Risk: ⚪ Minimal · up to 9ba30

Phones now start in direct typing, while choosing Input line remains remembered after reload. The reviewed mode flow shows no actionable merge risk beyond normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: phones now start in direct typing mode.
Description check Passed The description explains the behavior change, implementation details, documentation updates, validation results, and known baseline failures. It uses “Summary” and “Verification” instead of the templa…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha
devswha merged commit c989595 into main Oct 15, 2026
9 checks passed
@devswha
devswha deleted the feat/mobile-direct-typing-default branch October 15, 2026 10:56
devswha added a commit that referenced this pull request Oct 18, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant