Skip to content

fix(mobile): restore live terminal input caret and selection editing - #28294

Closed
Kyino-Pan wants to merge 2 commits into
stablyai:mainfrom
Kyino-Pan:ios-live-input-caret
Closed

Kyino-Pan wants to merge 2 commits into
stablyai:mainfrom
Kyino-Pan:ios-live-input-caret

Conversation

@Kyino-Pan

@Kyino-Pan Kyino-Pan commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The terminal's live input now shows a real text cursor, so you can tap or drag into the middle of your text and edit it.

What Changed

Show the existing native text field instead of an invisible field behind a text preview. Track its selection for accessory Backspace/Delete and restore the caret after those edits. Moving the local caret alone sends no terminal control keys; edited text still uses the existing terminal synchronization.

Scope against base 464bd5a54b33:

Part Files Added Removed
Visible input, status layout and event wiring 4 67 87
Selection tracking, accessory deletion and native/Web caret restoration 5 119 19
Regression tests and existing browser test probe 6 222 17
Total 15 408 123

Implementation totals 9 files, +186 / −106; tests and test support total 6 files, +222 / −17. Added plus removed lines total 531; the net increase is 285. These parts serve one interaction: move the caret, edit at that position, and keep the caret there. Accessory deletion must follow the selection once the field becomes directly editable; the Web change preserves the existing shared input behavior. No dependency, deployment-target, native startup, search, or desktop runtime changes.

Why

The hidden field made the insertion point invisible and prevented direct middle editing. Reusing the native field preserves system selection and input-method behavior without maintaining a second cursor implementation. Selection-aware accessory deletion is part of making that newly editable field work correctly.

Linked Issue

Fixes #27829

Visual Proof

Before — physical iPhone After — physical iPhone
Before — physical iPhone After — physical iPhone

These captures are from the earlier personal TestFlight build 0.0.53 (1), before this PR was narrowed and rebased. The tester confirmed typing after pairing to an SSH-accessed Mac mini. They illustrate the caret fix, not a physical-device rerun of this final commit.

Earlier simulator comparison (also historical)
Before — simulator After — simulator
Before — simulator After — simulator

Testing

  • User confirmed launch, pairing, middle-caret movement and continued typing on physical iPhone with personal TestFlight 0.0.55 (2), built from functional commit 4f49c124; the follow-up only adds docstrings.
  • iOS 17 Release simulator: pairing, middle insertion, accessory deletion, selection replacement, background/resume and submission to a real terminal.
  • Automated regression tests added/updated.

Validation of the narrowed source, based on 464bd5a54b33:

  • Documentation follow-up 752297c7: eight one-line docstrings, no runtime changes. Local AST audit finds all 11 touched function declarations documented; emitted JavaScript matches the tested functional commit. The 81 focused regressions, changed-code quality gate, formatting and commit hooks passed again. CodeRabbit's coverage recheck is pending.
  • Root and mobile typechecks; mobile test typecheck gate: passed.
  • Full mobile suite (pnpm test --maxWorkers=2): 986 files / 10,487 tests passed, 2 files / 6 tests skipped. An initial parallel run had one unrelated notification timeout; its isolated rerun and the complete lower-concurrency rerun passed.
  • Headless Chromium input suite (pnpm test:node config/scripts/mobile-web-app-terminal-live-input-render.test.mjs): 13 tests passed, including middle caret → accessory Delete → type X, with abcdef becoming abcXef.
  • Changed-code quality against the base: 15 files, zero new findings. Formatting and commit hooks passed.
  • Mobile Web production bundle and verification; Expo iOS JavaScript/Hermes bundle: passed. The latter is not a native Xcode build.
  • Full root pnpm build: passed, including typechecks and macOS native helpers with ad-hoc signing (not release packaging). Focused caret regressions: 81 tests passed.
  • Full root pnpm test --maxWorkers=3 with Bun 1.4.3: 117,949 passed / 52 failed, 24 failing files and one test-runner source-map error. Replaying those files on the pristine base reproduced 22 failing files and 50 failed tests. The remaining two files passed on both base and PR when rerun alone (6 tests). The full suite is not green; the runner error remains unresolved.

To reproduce on iPhone: enter abcdef, move between c and d, press accessory Delete, then type X; expect abcXef. Also check Backspace, selection replacement, Chinese composition, Enter and background/resume.

Author

GitHub: @Kyino-Pan · X: @KyinoShH

AI Disclosure

AI-assisted implementation and validation with Codex (GPT-6 family), with earlier human acceptance on a physical iPhone.

Review

Reuses the existing native input, design tokens and terminal synchronization. No wire format, host execution, SSH routing, folder-workspace behavior or platform shortcut mapping changes. Agent and integration protocols are unchanged. Review found no new credential handling or code-execution surface, and no added network work; selection updates stay local. Native/Web caret restoration has regression coverage; current-source iOS 17 interactions and the physical iPhone core flow have been validated. Full IME coverage, an explicit new-build SSH rerun and Android/Linux/Windows runs remain outstanding.

Agent skill upstream boundary

  • Not applicable; no upstream skill implementation is copied or translated.

Notes

This PR is ready for review, with the following validation limits. Full pnpm lint fails at src/main/orcad/orcad-entry.ts:420 (301 / 300). Running its later stages separately also finds five native-plugin cycle warnings; the other 21 stages pass. Both failure categories reproduce identically on the pristine upstream base. The changed-code gate passes with zero new findings.

Root build and full tests have now run, with the failures reported above. The base comparison used one worker rather than three, so it does not establish that every failure has the same cause. The CLI temporary-path failure disappears when using the canonical macOS temporary path; other baseline failures include PTY/environment and unavailable historical release fixtures. No unrelated fixes were added.

Xcode 26.5 (17F42) successfully archived functional commit 4f49c124 with the original generated native configuration and minimum iOS 15.1, without compatibility patches. A signed Release build on iOS 17.0 passed nine recorded interaction cases, including selection deletion, caret retention after background/resume and a command producing verified output in a real local terminal. These are observed simulator checks, not XCTest cases. The user confirmed launch, pairing and middle editing on their iOS 27 iPhone using personal TestFlight 0.0.55 (2). iOS 15.1 itself was not run; the minimum-target archive is compilation evidence only. The earlier Xcode 27 default-build failure remains toolchain-specific history. Related startup work in #22515 is separate from this fix.

The simulator used a local headless host, not SSH transport. Earlier SSH acceptance and the screenshots above remain historical. Full Chinese/Japanese input-method coverage was not repeated. Private TestFlight upload succeeded with a non-blocking missing Hermes dSYM warning, which may limit crash symbolication.

At the last recorded CI check, all four final-commit workflows were action_required (PR Checks, Mobile Checks, Headless Node server and PR test LoC); an upstream maintainer must allow them to run. This contributor account cannot approve them; their live status was not rechecked during this native-validation round. Android setup/testing is intentionally out of scope; Linux/Windows native runs were not repeated.

Checklist

  • This PR is small and focused.
  • Explained the user-facing before/after, mechanism and choice of approach.
  • Before/after screenshots attached, with their historical scope stated.
  • Self-reviewed for correctness, security and performance.
  • Cross-platform, SSH/remote and folder-workspace impact considered.
  • Full lint, typecheck, test and build gates all green; remaining limits are explicit above.

@Kyino-Pan
Kyino-Pan force-pushed the ios-live-input-caret branch from 5faac6e to 4f49c12 Compare October 14, 2026 02:41
@Kyino-Pan Kyino-Pan changed the title fix: restore iOS terminal caret and resolve build and compatibility blockers fix(mobile): restore live terminal input caret and selection editing Oct 14, 2026
@Kyino-Pan
Kyino-Pan marked this pull request as ready for review October 14, 2026 06:02
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 27020e73-f537-4880-8de9-26b4b5284c88
📥 Commits

Reviewing files that changed from the base of the PR and between 4f49c12 and 752297c.

📒 Files selected for processing: 7
  • mobile/src/session/MobileSessionCommandDock.tsx
  • mobile/src/session/MobileTerminalLiveInputStatus.tsx
  • mobile/src/session/use-mobile-session-terminal-runtime.ts
  • mobile/src/terminal/terminal-live-text-commit.ts
  • mobile/src/terminal/use-terminal-live-accessory-input-commit.test.ts
  • mobile/src/terminal/use-terminal-live-accessory-input-commit.ts
  • mobile/src/terminal/use-terminal-live-input-commit.ts
🚧 Files skipped from review as they are similar to previous changes: 7
  • mobile/src/session/use-mobile-session-terminal-runtime.ts
  • mobile/src/terminal/use-terminal-live-accessory-input-commit.test.ts
  • mobile/src/terminal/use-terminal-live-accessory-input-commit.ts
  • mobile/src/terminal/terminal-live-text-commit.ts
  • mobile/src/session/MobileSessionCommandDock.tsx
  • mobile/src/session/MobileTerminalLiveInputStatus.tsx
  • mobile/src/terminal/use-terminal-live-input-commit.ts

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

📝 Walkthrough

The live-input field now reports its native selection. Accessory Backspace and Delete apply edits at the caret or across the selected range, then update the field and terminal mirror. The session UI displays the editable field in the live-input row. Tests cover selection tracking, text writing, local edits, and browser-driven input.

Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 75229

The change makes the native live-input field visible and applies accessory Backspace/Delete at the caret. No concrete merge-blocking risk was identified from the supplied context. A manual native-device check is still outstanding, as noted in the PR description.

Pre-merge checks: Passed 7
Passed Passed checks: 7 passed
Check name Status Explanation
Linked Issues check Passed The description links the relevant issue with Fixes #27829 and explains how the changes address its caret and selection-editing requirements.
Out of Scope Changes check Passed The changed files support the stated mobile live-input caret and selection-editing objective. No unrelated product, deployment, protocol, or platform changes are reported.
Linked Issues check Passed The PR meets the coding requirements in [#27829]. MobileSessionCommandDock.tsx renders the existing native TextInput in the live-input bar. This preserves the native caret, selection, and horizont…
Out of Scope Changes check Passed The changes stay within [#27829]. The dock and style changes expose the native live-input field. The selection hooks, accessory edit logic, text writers, browser probe, and regression tests support ca…
Docstring Coverage Passed Docstring coverage is 91.67% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 15 files.
Title check Passed The title clearly and concisely describes the main change: restoring the mobile terminal input caret and selection-based editing.
Description check Passed The description is complete and directly aligned with the template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, known validation limits, AI disclosure,…
  • 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.

@Kyino-Pan

Copy link
Copy Markdown
Contributor Author

Hi @brennanb2025, since you're assigned to #27829, a quick update on this fix: all seven CodeRabbit checks now pass, including docstring coverage.

Validation is also complete for the original native configuration with Xcode 26.5 (Release archive, minimum iOS 15.1), core caret/selection interactions on the iOS 17 simulator, and launch, pairing and middle editing on a physical iPhone running iOS 27 via TestFlight. iOS 15.1 was verified as a compilation target, not a runtime test. Details and remaining validation limits are in the PR description.

The four GitHub Actions workflows are still awaiting maintainer approval (action_required). Could you take a look and approve the workflow runs when you have a moment? Thanks!

nwparker added a commit that referenced this pull request Oct 21, 2026
Display the existing input directly and synchronize accessory deletion with
its native UTF-16 selection, retaining the caret for subsequent typing.
Port and adapt community PR #28294 to the current command dock.

Co-authored-by: Kyino <[email protected]>
AmoabaKelvin pushed a commit that referenced this pull request Oct 28, 2026
Display the existing input directly and synchronize accessory deletion with
its native UTF-16 selection, retaining the caret for subsequent typing.
Port and adapt community PR #28294 to the current command dock.

Co-authored-by: Kyino <[email protected]>
AmoabaKelvin pushed a commit that referenced this pull request Oct 28, 2026
Display the existing input directly so its native caret shows. Accessory
Backspace/Delete edit at the field's caret, read from the input when pressed,
so edits that keep the caret (IME composition) still delete, and the caret is
restored for subsequent typing.
Port and adapt community PR #28294 to the current command dock.

Co-authored-by: Kyino <[email protected]>
AmoabaKelvin pushed a commit that referenced this pull request Oct 29, 2026
Display the existing input directly so its native caret shows. Accessory
Backspace/Delete edit at the field's caret, read from the input when pressed,
so edits that keep the caret (IME composition) still delete, and the caret is
restored for subsequent typing.
Port and adapt community PR #28294 to the current command dock.

Co-authored-by: Kyino <[email protected]>
AmoabaKelvin added a commit that referenced this pull request Oct 29, 2026
* fix(mobile): show live input caret and preserve selection edits

Display the existing input directly so its native caret shows. Accessory
Backspace/Delete edit at the field's caret, read from the input when pressed,
so edits that keep the caret (IME composition) still delete, and the caret is
restored for subsequent typing.
Port and adapt community PR #28294 to the current command dock.

Co-authored-by: Kyino <[email protected]>

* fix(mobile): keep live input caret keys local and the dock height fixed

Hardware Left/Right/Home/End moved both the visible field caret and the
PTY cursor, so the mirror erased at the wrong place. With field text they
now move only the field caret, like Backspace and Delete; Right/End at the
field end still reach the PTY so shells can accept an autosuggestion. On
Android the key binding lets plain caret keys through to that decision
instead of sending them to the PTY. The dictation and upload status covers
the field instead of adding a row, so starting or stopping either no longer
resizes the terminal.

* test(mobile): annotate the DOM field cast in the accessory input test

* chore(mobile): allowlist the live input field strings for localization coverage

---------

Co-authored-by: Kyino <[email protected]>
Co-authored-by: Kelvin Amoaba <[email protected]>
@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks for this. #31477 merged on 10-29: Live input shows the caret again and edits at the selection (#27829, now closed). Closing this as superseded.

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.

[Bug]: iOS Live input hides the local caret when moving the insertion point

2 participants