iOS: toggleable iMessage-style terminal composer (text, PR1)
Summary
- Adds a toggleable iMessage-style composer above the iOS terminal (PR1 of a phased feature). A new composer button on the input accessory bar shows/hides a growing multi-line text field with a Send button.
- Send delivers the text as a bracketed paste + a single Return via a new
mobile.terminal.paste/terminal.pasteRPC, so a multi-line message lands as one submission. The existingterminal.inputpath is wrong for a composed block: its Mac handler rewrites every\n/\rto a raw CR, so an N-line message fragments into N submissions in a TUI agent. - Mac:
v2MobileTerminalPastebracketed-pastes viaTerminalSurface.sendText(ghostty_surface_text, respects DECSET 2004) then sends an optional submit key viasendNamedKey, mirroring the macOS TextBox composer dispatch[.pasteText(payload), .namedKey(submitKey)]. Reuses the proven surface send paths; no new libghostty code. - iOS: new
.composeraccessory action (appended at the end of the enum to preserve persisted raw values) +onToggleComposercallback wired through a newGhosttySurfaceViewDelegatemethod to a storeisComposerPresentedflag. While the composer is open the docked accessory bar yields the bottom edge + keyboard (setComposerActive). NewsendRemoteTerminalPastesend path +submitComposerInput().
Out of scope (follow-up PRs)
- PR2: inline image/file attachments (needs a new
mobile.terminal.upload_fileRPC; render-grid transport is display+input only today). - PR3:
@file /$skill autocomplete (needs new cwd file-search + skill-list RPCs). When added, mirror the macOS insertion format exactly ([label](path)for@, bare$skill-namefor$). - Submit key is
returnfor all agents. The macOS Claude+multiline→ctrl+enterheuristic is deferred (submit_keyis already overridable on the RPC); this is the first knob if Claude multi-line submit misbehaves.
Testing
- iOS app builds for the simulator; Mac app builds (tagged). No automated behavior test: the surface-write path needs a live libghostty surface and the paste RPC travels over the paired NWListener (not the debug socket), so a meaningful end-to-end test is not practical here. Per the repo test-quality policy, a source-shape test is intentionally not added.
- Behavior is pending device dogfood (the simulator can't pair to a Mac host). Dogfood steps:
- Toggle the composer on; type a 3-line message (include a blank interior line); Send. Confirm it lands as one submission, not three, against both a bare
zshprompt and a running Claude/codex. - Confirm the composer sits above the keyboard without overlapping the terminal or leaving a dead strip where the docked accessory bar was.
- Confirm the chevron closes the composer and restores the accessory bar (with its composer button).
- Toggle the composer on; type a 3-line message (include a blank interior line); Send. Confirm it lands as one submission, not three, against both a bare
Localization
- Added en + ja for the 4 new composer keys (
terminal.input_accessory.composer,mobile.composer.close,mobile.composer.placeholder,mobile.composer.send) inios/cmux/Resources/Localizable.xcstrings. The composer-toggle string is accessibility-only (the button is symbol-based).
Design
- Full phased design:
plans/feat-ios-composer-textbox/DESIGN.md(in the cmuxterm-hq control repo).
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.
[!NOTE]
Medium Risk
Introduces a new Mac RPC path that writes directly to terminal surfaces and agent-specific submit-key heuristics; failures are mitigated by keeping composer text on RPC errors, but behavior depends on paired Mac version supporting terminal.paste.
Overview
Adds a toggleable iMessage-style composer on iOS for multi-line messages above the remote terminal, wired end-to-end through a new terminal.paste mobile RPC instead of terminal.input.
On iOS, a new Composer accessory button toggles isComposerPresented; TerminalComposerView (multi-line field + send/chevron) sits in a bottom safeAreaInset and reuses terminalInputText. While open, GhosttySurfaceView.setComposerActive hides the docked accessory bar and releases grid height; autofocus is suppressed so the composer keeps the keyboard without flicker. Send calls submitComposerInput() → sendRemoteTerminalPaste with submit_key: "return", clears text only after Mac ack, and blocks double-send re-entrancy.
On Mac, v2MobileTerminalPaste bracketed-pastes via sendText then optionally sendNamedKey (mirroring macOS TextBox). For multi-line text on a Claude Code surface, return intent upgrades to ctrl+enter. TextBoxAgentDetection is exposed for that check.
UI polish: Liquid Glass helpers (mobileGlassField / mobileGlassCircle) and en/ja localization for composer strings.
Reviewed by Cursor Bugbot for commit 56d0fd6287bc3273d8dedf64f19cf713a032bfe0. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds a toggleable iMessage-style composer above the iOS terminal to draft multi-line messages and send them as one paste+submit via a new terminal.paste RPC, with Liquid Glass styling and a flicker-free keyboard handoff. On Mac, Return is upgraded to ctrl+enter for Claude multi-line blocks, mirroring the desktop TextBox behavior.
-
New Features
- New
.composeraccessory button opens a growing multi-line field with Send; it owns the bottom edge + keyboard and stays open after send. - Send path:
submitComposerInput()→sendRemoteTerminalPaste()→ Macv2MobileTerminalPaste(bracketed paste viasendText+ optionalsendNamedKey), reusing existing surface paths (no newlibghostty). - Layout: composer sits in a bottom
safeAreaInset;setComposerActivehides the docked bar and releases grid height; autofocus is deferred for a smooth handoff. - Localization: added
terminal.input_accessory.composer,mobile.composer.close,mobile.composer.placeholder,mobile.composer.send(en, ja).
- New
-
Bug Fixes
- Clear the field only after Mac ack; preserve text on failure and during in-flight edits.
- Guard against double-tap sends to prevent duplicate pastes.
- Disarm accessory modifiers when opening the composer; suppress terminal autofocus while it’s presented to keep input in the composer.
Summary by CodeRabbit
- New Features
- Multi-line iOS terminal composer with chevron toggle, auto-focus, and disabled Send when input is empty.
- Submit sends composed text as a single block and keeps composer open on failures for retry.
- UI
- Terminal claims/releases bottom/keyboard area and adds a Composer accessory button; new glass-style backgrounds for composer controls.
- Localization
- Added English and Japanese strings for composer labels, placeholder, send, and hide.