mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-30 16:39:33 +01:00
fix(web): bind Send on Enter to the captured session, keep the voice draft (#830)
Held-mode Ctrl, Backspace and restored drafts send to the session their text was typed for; a Ctrl-only field releases it. Voice compose Send settles the iOS owner without flushing the unsent local-echo draft. Cover Send on Enter across focus moves, the toolbar Enter in the CJK field and the same-session reload. Describe Pane B iOS input ownership; drop a stub for a removed helper.
This commit is contained in:
1 parent
eb22f10fd4
commit
ddb5a647ba
8 files changed
+254
-85
No files matched your search
@@ -353,10 +353,17 @@ const CjkInput = (() => {
|
||||
return;
|
||||
}
|
||||
_t('hold ctrl key');
|
||||
_textarea.value = PHANTOM + before;
|
||||
_textarea.setSelectionRange(1 + at, 1 + at);
|
||||
_heldBase = before;
|
||||
_send(now[at]);
|
||||
// The control key goes to the session this field's text was captured for;
|
||||
// with no draft left, the next answer captures its own destination.
|
||||
const target = _targetForSend();
|
||||
if (!before) {
|
||||
_resetToPhantom();
|
||||
} else {
|
||||
_textarea.value = PHANTOM + before;
|
||||
_textarea.setSelectionRange(1 + at, 1 + at);
|
||||
_heldBase = before;
|
||||
}
|
||||
_send(now[at], target);
|
||||
}
|
||||
|
||||
/** Send-on-Enter input handling: nothing is flushed, the field only settles.
|
||||
@@ -370,7 +377,7 @@ const CjkInput = (() => {
|
||||
const wasEmpty = !_heldBase;
|
||||
_heldBase = _strip(_textarea.value);
|
||||
if (!_heldBase) {
|
||||
if (wasEmpty) _send('\x7f');
|
||||
if (wasEmpty) _send('\x7f', _targetForSend());
|
||||
_resetToPhantom();
|
||||
} else if (!_textarea.value.startsWith(PHANTOM)) {
|
||||
// Backspace at the very start of the text deleted the phantom: put it
|
||||
@@ -801,6 +808,10 @@ const CjkInput = (() => {
|
||||
_textarea.value = PHANTOM + draft;
|
||||
_textarea.setSelectionRange(_textarea.value.length, _textarea.value.length);
|
||||
_heldBase = draft;
|
||||
// The restored text belongs to this session: Enter after a focus move to
|
||||
// another pane must still send it here (see _targetForSend).
|
||||
_target = sessionId;
|
||||
_hasTarget = true;
|
||||
_autoGrow();
|
||||
},
|
||||
|
||||
|
||||
@@ -1079,8 +1079,10 @@ const VoiceInput = {
|
||||
app.showToast?.('That session has closed; dictation not sent', 'warning');
|
||||
return Promise.resolve();
|
||||
}
|
||||
// Settle the destination's iOS owner, but leave an unsent local-echo draft
|
||||
// in the overlay: flushing it would prepend it to the reviewed dictation.
|
||||
const pane = app._paneForSession?.(target);
|
||||
if (pane) app._prepareExternalInput?.(pane, 'voice-send', { flushEcho: true });
|
||||
if (pane) app._prepareExternalInput?.(pane, 'voice-send');
|
||||
app._sendInputAsync(target, text, { useMux: true });
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user