fix(mobile): Send on Enter fourth review fixes

- 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>
This commit is contained in:
Kamil KaliszandClaude Opus 5.5 committed 2026-11-16 21:53:27 +01:00
1 parent 80d719df5f
commit b5ad7afebe
6 files changed
+79 -6

No files matched your search

+1 -1
View File
@@ -10047,8 +10047,8 @@ class CodemanApp {
this._cleanupPreviousSession(sessionId, { keepCjkDraft: reloadingSameSession });
this.activeSessionId = sessionId;
if (typeof CjkInput !== 'undefined') CjkInput.restoreDraft?.(sessionId);
this._activateFileBrowserSession?.(sessionId);
if (typeof CjkInput !== 'undefined') CjkInput.restoreDraft?.(sessionId);
// A keyboard row hold belongs to the session it was taken for: release it here
// if this one resizes instead (the geometry work below then fits it).
this._reconcileKeyboardHold?.({ resize: false });
+13 -2
View File
@@ -4577,8 +4577,13 @@ Object.assign(CodemanApp.prototype, {
* single character is typed (a selection dialog ignores a pasted `3`, then
* Enter confirms the highlighted option), anything else goes through the
* composer's path as one bracketed paste. The session is captured now, so the
* delayed Enter cannot follow a tab switch. Returns false when nothing was
* sent (no session, too long), so the field keeps the text.
* delayed Enter cannot follow a tab switch. A lone digit while the session
* shows a permission or question dialog goes out without the Enter: the
* dialog acts on the digit itself, and a later Enter would confirm whatever
* the CLI shows next (a second permission prompt, unseen). Same rule as the
* Approvals Inbox and the Discord bridge (server.ts awaitingChoice). Returns
* false when nothing was sent (no session, too long), so the field keeps the
* text.
*/
_sendCjkPrompt(text) {
const sessionId = this.activeSessionId;
@@ -4594,6 +4599,12 @@ Object.assign(CodemanApp.prototype, {
if ([...text].length === 1) {
if (this._localEchoPolicy === 'predict') this._predictiveEcho?.clearPredictions();
this._sendInputAsync(sessionId, text);
const hooks = this.pendingHooks?.get(sessionId);
const awaitingChoice = !!hooks && (hooks.has('permission_prompt') || hooks.has('elicitation_dialog'));
if (/^\d$/.test(text) && awaitingChoice) {
_crashDiag.log(`CJK prompt digit answers a dialog, no Enter`);
return true;
}
setTimeout(() => this._sendInputAsync(sessionId, '\r', { useMux: true }), 120);
return true;
}