mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-20 13:09:33 +01:00
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:
1 parent
387cb830f4
commit
57fdb52f7c
4 files changed
+30
-3
No files matched your search
@@ -672,9 +672,18 @@ const CjkInput = (() => {
|
||||
// unchanged, leave the field alone, since rewriting its attributes while
|
||||
// it has focus can disturb a composition in progress.
|
||||
if (_holdApplied && _textarea && _hold === !!on) return;
|
||||
const wasHolding = _hold;
|
||||
_hold = !!on;
|
||||
if (!_textarea) return;
|
||||
_holdApplied = true;
|
||||
// Turning the mode off: live mode's next flush would send everything in
|
||||
// the field, a held multi-line draft included (its newline runs the first
|
||||
// line in a shell), and stashed drafts would come back if the mode is
|
||||
// switched on again. Drop them all.
|
||||
if (wasHolding && !_hold) {
|
||||
_drafts.clear();
|
||||
_resetToPhantom();
|
||||
}
|
||||
_heldBase = _strip(_textarea.value);
|
||||
const v = _hold ? 'on' : 'off';
|
||||
_textarea.setAttribute('autocorrect', v);
|
||||
|
||||
@@ -4555,8 +4555,10 @@ Object.assign(CodemanApp.prototype, {
|
||||
// after every key. So the onData hook never sees these keystrokes, and an
|
||||
// armed modifier could neither fire NOR be spent: it survived until a
|
||||
// session switch and then turned an innocent keystroke into a control byte.
|
||||
// This is the module's single choke point to the PTY, so applying it here
|
||||
// covers typed characters, IME flushes, Enter, backspace and arrows at once.
|
||||
// This is the module's single choke point to the PTY in live mode, so applying
|
||||
// it here covers typed characters, IME flushes, Enter, backspace and arrows at
|
||||
// once. In Send on Enter a held answer leaves through _sendCjkPrompt instead,
|
||||
// which spends the modifier; an armed next character still comes here.
|
||||
// Same policy as the onData hook: the next single character is modified,
|
||||
// anything longer merely spends the modifier.
|
||||
if (typeof KeyboardAccessoryBar !== 'undefined' && KeyboardAccessoryBar.isCtrlArmed?.()) {
|
||||
|
||||
Reference in new issue
Block a user