Repository navigation
Conversation
A per-device setting next to CJK Input keeps typed text in the pinned field until Enter instead of streaming it to the PTY, so a phone user can scroll the terminal and edit an answer before sending (Termux-style). One line goes as text + CR, several lines as one bracketed paste with a delayed Enter, like the prompt composer. Shift+Enter is a newline, Escape clears, Backspace on an empty field still reaches the PTY, and autocorrect is on in this mode. The field grows with its text and the keyboard layout reserves its real height. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7e2e4f1 to
e0e2f68
Compare
…nter Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for this and for the clear write-up, and welcome to Codeman. This PR adds a per-device Send on Enter mode to the pinned CJK input field: on a phone, a typed answer stays in the field while you scroll the terminal and goes out only when you press Enter. The change is focused, the settings plumbing is right (display key, mobile default, stripped from the strict settings PUT, zh-CN strings), live mode is unchanged, and typecheck, lint, format, the frontend checks and the related tests all pass locally. These need fixing before merge:
Smaller ones, fine in this PR or as a follow-up:
Your question about where the setting should live (a mode of the CJK field, or an option of the mobile prompt entry from #359) is still open. The fixes above apply wherever it ends up. Once 1 to 5 are addressed, this is in good shape to merge. |
- A long single line (over 64 characters) or several lines now go through the composer's _sendComposedPrompt: one bracketed paste, then Enter as a separate delayed write to the session captured at Enter. Claude Code took a long `<text>\r` burst as a paste and left it unsent, and the old delayed Enter followed a tab switch. A refused prompt keeps the text in the field. - Deleting held text no longer sends Backspace to the PTY. It goes out only when the field was already empty (the phantom itself deleted), so select-all + delete is covered too. - With the one-shot Ctrl armed, the next single typed character skips the hold and reaches _handleCjkInput, which turns it into the control byte; any other change spends the modifier, as in live mode. - A reload of the session already shown (tapping its tab, the geometry retry) keeps a held draft. - With the keyboard down the field stays one line tall, so it no longer covers the terminal's last rows. - zh-CN strings for both field placeholders, and a test pinning cjkInputHoldUntilEnter as per-device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks a lot for the detailed review, really helpful. I could reproduce all of them, and they're fixed in 95fb147. I've also been using it on my Android phone today and it behaves well.
I did the smaller ones in this PR too:
The docs paragraph is updated as well. On where the setting should live, I'm fine either way. If you'd rather have it as an option of the mobile prompt entry from #359, I can move it. |
|
Thanks for turning the first review around so quickly, kkalisz. This PR adds a per-device Send on Enter mode to the pinned CJK input field, so on a phone a typed answer stays in the field while you scroll the terminal and goes out on Enter. All five fixes and the three smaller ones from the first review are in and correct: the long and multi-line path through Two things still need fixing before merge. The first comes from my own suggestion in the first review, so sorry for the extra round.
Smaller ones, fine in this PR or as a follow-up:
Where the setting should live (a mode of the CJK field, or an option of the mobile prompt entry from #359) is still an open question. The fixes above apply either way. Once 1 and 2 are in, this is ready to merge. |
- Never send a held answer as text + CR in one write: Codex folds an Enter in the same burst into a paste. A single character is typed, then CR ~120 ms later to the session captured at Enter; anything longer goes through _sendComposedPrompt. Drops HELD_DIRECT_MAX. No session keeps the text in the field. - Cap #cjkInput at 68px on every device, not only touch. - _autoGrow adds the border height and skips a hidden field. - setHoldUntilEnter returns early when the mode is unchanged. - Per-session held drafts: stashed on switch and tile focus, restored on return, dropped when the session is removed. - Toolbar Enter presses Enter in the visible CJK field (commits an active composition first). - Blank-only field sends a bare Enter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks again, and no worries about the 64-char suggestion. I hadn't tested with Codex either, and the note in
Smaller ones:
I couldn't run Codex here, so the Codex part relies on your measurement. |
|
Thanks for the third round, kkalisz, and for building the Codex split exactly as described without a Codex to test against. This PR adds a per-device Send on Enter mode to the pinned CJK input field: on a phone, a typed answer stays in the field while you scroll the terminal and only goes out when you press Enter. Both fixes from the second review are in and correct. Every held answer now goes out with Enter as its own write. A single character is typed and I found one more small bug and two doc lines to update. I will apply them on top at merge time, so you don't need to push anything:
Your question about where the setting should live (a mode of the CJK field, or an option of the mobile prompt entry from #359) is still open. None of the code above depends on it. Thanks again for sticking with this through three rounds, and for running it on your own phone the whole way. |
goHome() nulled activeSessionId without stashing the field, so picking the session again cleared the draft. Stash it first. Docs: src/web/CLAUDE.md lists cjkInputHoldUntilEnter among the per-device keys the strict schema does not declare, and notes the sendEnterKey() exception for the visible CJK field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks! I went ahead and pushed those three in 80d719d so you don't have to apply them at merge: the stash before the null in On where the setting lives, I'm happy with whatever you prefer, now or in a follow-up. |
|
Thanks for the fourth round, kkalisz, and for pushing the Home fix and both 80d719d does what it should. Two things need fixing before merge. The second comes from my own suggestion in the second review, so sorry for one more round:
Smaller things, fine in this PR or in a follow-up:
Where the setting should live (a mode of the CJK field, or an option of the mobile prompt entry from #359) is still an open question. None of the code above depends on it. Once 1 and 2 are in, this is ready to merge. Thanks again for the care you've put into every round. |
- selectSession restores the CJK draft after _activateFileBrowserSession, which test/file-browser-search.test.ts pins right after the activeSessionId assignment. - A lone digit while the session has a pending permission_prompt or elicitation_dialog goes out without the delayed Enter: the dialog acts on the digit, and the Enter would confirm whatever comes next. Same rule as the Approvals Inbox and the Discord bridge. - Changeset mentions the toolbar Enter sending the CJK field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, and good catch on the digit. Both are in b5ad7af.
Also the changeset sentence for the toolbar Enter. I've left the other smaller items for a follow-up so this round stays small. Checks here: typecheck, lint, format:check, check:frontend-syntax, check:frontend-dead and check:browser-excludes pass. Full |
…a held field - CjkInput remembers which session the field's text belongs to (set by restoreDraft) and clear() stashes a held draft under it, so the paths that drop the active session before the next cleanup (goHome, _replaceTileGrid, _onTileAdoptedElsewhere) keep the answer. discardDraft() drops the owner of a removed session. - Tile focus no longer stashes again for a tile closed from this tab. - With a draft in the field, Ctrl shortcuts (undo, select all, copy) are the field's; they reach the CLI only while it is empty, like Backspace and the arrows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I went ahead with the smaller items from your last review too, in 673a656, so they don't need a follow-up:
Tests in typecheck, lint, format:check, check:frontend-syntax, check:frontend-dead and check:browser-excludes pass. Full |
|
Thanks for the fifth round, kkalisz, and for picking up the smaller items as well. This PR adds a per-device Send on Enter mode to the pinned CJK input field: on a phone, a typed answer stays in the field while you scroll the terminal, and goes out only when you press Enter. b5ad7af and 673a656 work as described. The owner stash in
I will apply that on top at merge time, along with a short Send on Enter section in the Where the setting should live (a mode of the CJK field, or an option of the mobile prompt entry from #359) is still an open question. None of the code above depends on it. Thanks again for sticking with this across five rounds and testing each one on your own phone. |
clear({ discard: true }) skips the owner stash, drops any older stash of
the owner and keeps the owner; clearTerminalInput() (the keyboard bar's
clear-line key) uses it, so a cleared draft does not come back on a
same-tab reload or a switch back. @fileoverview gains a Send on Enter
section.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks! I pushed both in 387cb83 so there's nothing left to apply at merge:
typecheck, lint, format:check, check:frontend-syntax, check:frontend-dead and check:browser-excludes pass, and so do the CJK and keyboard tests. Full |
|
Thanks for the sixth round, kkalisz, and for pushing the clear-line fix and the 387cb83 does what it should. The keyboard bar's clear-line key now throws a held draft away, both new tests pin that, and the I found one more small edge and one out-of-date doc sentence:
Both are small, so I will apply them on top at merge time and you don't need to push anything. Where the setting should live (a mode of the CJK field, or an option of "Mobile prompt entry" from #359) is still an open question. None of the code above depends on it. Thanks again for six careful rounds, and for testing each one on your own phone. |
setHoldUntilEnter going from on to off clears the stashed drafts and resets the field, so live mode's next flush sends only the new key, not a held multi-line draft. The invariants doc and the _handleCjkInput comment name _sendCjkPrompt as the path a held answer takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks! Both are in 57fdb52, so again nothing to apply at merge:
typecheck, lint, format:check, check:frontend-syntax, check:frontend-dead and check:browser-excludes pass, and so do the CJK and keyboard tests. Full |
|
Thanks for the seventh round, kkalisz, and for testing every round on your own phone. This PR adds a per-device Send on Enter mode to the pinned CJK input field: on a phone, a typed answer stays in the field while you scroll the terminal and goes out only when you press Enter. 57fdb52 does what the last review asked. Turning the mode off now drops the held draft and the stashed ones, so live mode's next flush sends only the new key, and the "single choke point" wording in I found three small things. I will apply them on top at merge time, so you don't need to push anything.
Where the setting should live (a mode of the CJK field, or an option of "Mobile prompt entry" from #359) is still an open question. None of the code above depends on it. Thanks again for sticking with this across seven rounds. |
- input-cjk.js translates its placeholder with CodemanI18n.t(), like the prompt composer, since i18n.js skips <textarea> subtrees; the zh-CN entries now show. - The field only grows on touch devices, where it is position: fixed. On a desktop it sits under the terminal, so growing would shrink the terminal box and resize the PTY on every line; it stays one line and scrolls there. - Input And Voice: a line break needs a hardware keyboard (no Shift+Enter on a phone keyboard, and the extended bar's newline key goes to the CLI). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks! I pushed all three in 3c5b7e2, so there's nothing left to apply at merge:
typecheck, lint, format:check, check:frontend-syntax, check:frontend-dead and check:browser-excludes pass, and so do the related tests. Full |
|
Thanks for the eighth round, kkalisz, and for testing every round on your own phone. This PR adds a per-device Send on Enter mode to the pinned CJK input field: on a phone, a typed answer stays in the field while you scroll the terminal and goes out only when you press Enter. 3c5b7e2 covers what the last review asked for on desktop and in the docs. Three things are left, all small:
I will apply these on top at merge time, so you do not need to push anything. Where the setting should live (a mode of the CJK field, or an option of "Mobile prompt entry" from #359) is still an open question. None of the code above depends on it. Thanks again for eight careful rounds. |
…an, iOS lift
Found on a real Android phone (Chrome) and iPhone (Safari) with Send on Enter:
- A swipe that started on the live screen closed the keyboard: the content
touchstart blurred the focused input before the gesture was known to be a
tap or a scroll. It now skips the visible #cjkInput
(_contentTouchStartBlurs()); a real tap still closes it (inert content, a
link, a long press).
- Focusing the field scrolled the terminal off screen: KeyboardHandler's
focusin scrollIntoView({ block: 'center' }) centred the fixed field in its
ancestors. isInputElement() skips #cjkInput like xterm's inputs.
- Android pans the visual viewport to reveal the field (offsetTop 285 in a
458/744 viewport), leaving only the terminal's last line visible. On phones
.app now follows visualViewport.offsetTop while the keyboard is up, and the
fixed bars inside .app are lifted from .app's bottom, so a partial pan does
not lift them twice. Non-phone branches and resetLayout() clear the shift.
- On iOS the first keyboard open reported innerHeight as the visual height
(323 vs 640), zeroing the bars' lift; the layout height is now the larger of
innerHeight and documentElement.clientHeight.
Tests in test/keyboard-handler-pinned-field.test.ts and
test/terminal-touch-tap.test.ts; docs in architecture-invariants and
src/web/CLAUDE.md; changeset sentence.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Using Send on Enter on real phones turned up four more keyboard problems around the pinned field, so I tested it properly on both platforms and fixed them in e85bb83 (one commit). To see what the browsers actually do, I ran a temporary diagnostics build on my own install (not part of the PR) that logged touch targets, focus and blur, What was wrong
(3) and (4) change the shared phone keyboard layout, so they apply to every phone user, not only the field; the changeset says so. Tested on both platformsOn my own install (this branch plus the diagnostics), on an Android phone and an iPhone, with CJK Input and Send on Enter on, in a Claude session and a shell session:
Automated
Docs: a paragraph each in the keyboard-dismiss and folding-devices parts of One edge I could not make happen but want to name: while |
|
Thanks for the ninth round, kkalisz, and for tracking these layout problems down on both an Android phone and an iPhone. This PR adds a per-device Send on Enter mode to the pinned CJK input field: on a phone, a typed answer stays in the field while you scroll the terminal, and it goes out only when you press Enter. e85bb83 fixes real problems. A swipe on the live screen no longer closes the field's keyboard, and focusing the field no longer scrolls the terminal away. With the pan-follow, the header and terminal stay on screen when Chrome pans to the field. Here, typecheck, lint, format, the frontend syntax, dead-code, browser-exclude and public-asset checks and the full There is one regression in the new layout code:
The three items from the last round are still open. I will apply them at merge time together with the fix above, so you don't need to push anything:
On scope: as your changeset says, the Where the setting should live (a mode of the CJK field, or an option of "Mobile prompt entry" from #359) is still an open question. None of the code above depends on it. Thanks again for nine careful rounds. |
- The phone case sheet (#mobileCasePickerModal) is inside .app, so once .app follows a pan it takes the same insideLift as the bars. The layout gap on top lifted it twice (186px above the keyboard at offsetTop 100). Comment, architecture-invariants and a test case updated. - setHoldUntilEnter() writes the placeholder before the unchanged-mode early return, only when the text differs, so a live language switch shows up without touching the rest of the field. - Settings-Reference: Shift+Enter needs a hardware keyboard. - styles.css: the #cjkInput cap is a backstop now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, good catch on the case sheet. You were right that it sits inside
typecheck, lint, format:check, check:frontend-syntax, check:frontend-dead and check:browser-excludes pass, and so do the 19 test files that load |
|
Thanks for the tenth round, kkalisz, and for testing each change on both an Android phone and an iPhone. This PR adds a per-device Send on Enter mode to the pinned CJK input field: on a phone, a typed answer stays in the field while you scroll the terminal, and it goes out only when you press Enter. c639b38 fixes everything from the last review. On a partial pan the case sheet now gets the same lift as the bars. The placeholder follows a live language switch and leaves the rest of the field alone. On my side, typecheck, lint, format, the frontend syntax, dead-code, browser-exclude, public-asset and lockfile checks and the full Nothing is left to change, and I have nothing to add at merge time, so this can be merged as it is. Your question about where the setting should live (a mode of the CJK field, or an option of "Mobile prompt entry" from #359) is still open. None of the code depends on the answer. Thanks again for sticking with this through ten rounds. |
Why
Sometimes an agent asks me a lot of questions at once. With a "grill me" skill, for example, it lists ten or twenty questions and I answer them in one go. To do that I need to see the questions and my answer at the same time: scroll the terminal to the next question, write a bit, scroll again, keep writing.
On my phone that doesn't work today. Whatever I type goes straight into the terminal. If I scroll up to reread a question, the keyboard closes and my half-written answer is stuck somewhere I can't see.
The prompt composer (#359, #444) helps, but it's a pop-up that covers the terminal: close it to scroll, reopen it to keep typing. For a long list of questions, that gets tiring.
The CJK Input field is almost what I wanted. It sits above the keyboard and stays put while the terminal scrolls. It just sends each character to the terminal right away and then empties itself.
What this adds
A new setting next to CJK Input: Input Field: Send on Enter (off by default, saved per device).
With CJK Input and this setting on, the field works like a chat box:
With the setting off, CJK Input works exactly as it does today.
Screen.Recording.2026-11-16.at.11.38.25.mov
Implementation notes
cjkInputHoldUntilEnter. LikecjkInputEnabled, it's indisplayKeysand the mobile defaults, and it's stripped from the server PUT becauseSettingsUpdateSchemais strict._flush()returns early in this mode, so the debounce, the physical-key fast path and composition end no longer send anything. Only Enter does._sendComposedPrompt, and paste markers inside the text are dropped first.max-height: 68px, then scrolls. When the field is visible,KeyboardHandler.updateLayoutForKeyboard()reserves its real height instead of a fixed 44px.docs/wiki/Settings-Reference.mdand a paragraph in the CJK input section ofdocs/wiki/Input-And-Voice.md. Also zh-CN strings for the new setting.Testing
test/input-cjk-hold.test.ts(14 tests). It runs the realinput-cjk.jsand covers each behavior above, plus the default mode still streaming text. Removing the hold check makes 4 of these tests fail, and removing the multi-line path makes the 2 paste tests fail.npm test: 17,059 of 17,146 pass. The failing tests are in git, file, worktree, watcher and sensor code (none in input or mobile code), and they fail the same way on master on my Mac.Verified
I've been running this on my own install (1.51.0 plus this change) since 2026-11-15, from my Android phone. My answer stays in the field while I scroll back to the question, and Enter sends it.
Open question
This is a draft. I'm happy to rename the setting or move it. It could also be a third option under "Mobile prompt entry" from #359.