fix(mobile): turning Send on Enter off drops the held draft

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>
This commit is contained in:
Kamil KaliszandClaude Opus 5.5 committed 2026-11-17 02:37:01 +01:00
1 parent 387cb830f4
commit 57fdb52f7c
4 files changed
+30 -3

No files matched your search

+16
View File
@@ -305,6 +305,22 @@ describe('CJK input: Send on Enter', () => {
expect(textarea.value).toBe(PHANTOM);
});
it('turning the mode off drops the held draft and the stashes, so live mode sends only new keys', () => {
const { CjkInput, textarea, sent } = load();
CjkInput.restoreDraft('session-a');
type(textarea, 'rm -rf build\nsecond line');
CjkInput.stashDraft('session-b');
CjkInput.setHoldUntilEnter(false);
expect(textarea.value).toBe(PHANTOM);
type(textarea, 'x');
vi.advanceTimersByTime(1000);
expect(sent).toEqual(['x']);
CjkInput.setHoldUntilEnter(true);
CjkInput.clear();
CjkInput.restoreDraft('session-b');
expect(textarea.value).toBe(PHANTOM);
});
it('turns autocorrect on in the mode and back off without it', () => {
const { CjkInput, textarea } = load();
expect(textarea.attrs.autocorrect).toBe('on');