fix(mobile): Send on Enter review fixes

- 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>
This commit is contained in:
Kamil KaliszandClaude Opus 5.5 committed 2026-11-16 14:18:18 +01:00
1 parent b8a4466643
commit 95fb147e9c
9 files changed
+474 -33

No files matched your search

+25
View File
@@ -1083,6 +1083,10 @@ Object.assign(CodemanApp.prototype, {
send: (text) => {
this._handleCjkInput(text);
},
// Send on Enter: a long or multi-line held answer goes out like the
// mobile prompt composer's Send (one bracketed paste, then Enter as a
// separate delayed write), bound to the session it was typed for.
sendPrompt: (text) => this._sendCjkPrompt(text),
});
}
@@ -4564,6 +4568,27 @@ Object.assign(CodemanApp.prototype, {
this._sendInputAsync(this.activeSessionId, text);
},
/**
* Send on Enter (CjkInput, setting cjkInputHoldUntilEnter): deliver a held
* answer that is too long for one `<text>\r` write, or has several lines.
* Claude Code takes a long burst as a paste and its \r as a newline, so it goes
* through the composer's path instead: the session is captured now, so the
* delayed Enter cannot follow a tab switch, and the length check applies.
* Returns false when nothing was sent, so the field keeps the text.
*/
_sendCjkPrompt(text) {
const sessionId = this.activeSessionId;
if (!sessionId || typeof KeyboardAccessoryBar === 'undefined') {
_crashDiag.log(`CJK prompt DROP no-session len=${text.length}`);
return false;
}
// A multi-character chunk spends an armed one-shot Ctrl (same rule as
// _handleCjkInput); leaving it armed would modify the next keystroke.
KeyboardAccessoryBar.clearCtrl?.();
_crashDiag.log(`CJK prompt→${sessionId.slice(0, 8)} len=${text.length}`);
return KeyboardAccessoryBar._sendComposedPrompt(sessionId, text);
},
/**
* Re-assert a history anchor captured before a terminal write (#358).
*