mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-07 16:09:43 +02:00
fix(mobile): release echo passthrough after compose
This commit is contained in:
@@ -1276,6 +1276,7 @@ const KeyboardAccessoryBar = {
|
|||||||
const send = () => {
|
const send = () => {
|
||||||
const text = textarea.value;
|
const text = textarea.value;
|
||||||
if (!text || !this._sendComposedPrompt(sessionId, text)) return;
|
if (!text || !this._sendComposedPrompt(sessionId, text)) return;
|
||||||
|
app._echoPassthroughSessions?.delete(sessionId);
|
||||||
this._composerDrafts.delete(sessionId);
|
this._composerDrafts.delete(sessionId);
|
||||||
this._syncComposerDraftIndicator();
|
this._syncComposerDraftIndicator();
|
||||||
close({ preserveDraft: false });
|
close({ preserveDraft: false });
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ function loadComposer(sessionId = 'session-1') {
|
|||||||
_localEchoOverlay: localEcho,
|
_localEchoOverlay: localEcho,
|
||||||
_flushedOffsets: new Map<string, number>(),
|
_flushedOffsets: new Map<string, number>(),
|
||||||
_flushedTexts: new Map<string, string>(),
|
_flushedTexts: new Map<string, string>(),
|
||||||
|
_echoPassthroughSessions: new Set<string>(),
|
||||||
_predictiveEcho: { clearPredictions: vi.fn() },
|
_predictiveEcho: { clearPredictions: vi.fn() },
|
||||||
_sendInputAsync: vi.fn(),
|
_sendInputAsync: vi.fn(),
|
||||||
_uploadAndInsertImages: vi.fn(async () => ['/tmp/image-one.png']),
|
_uploadAndInsertImages: vi.fn(async () => ['/tmp/image-one.png']),
|
||||||
@@ -248,6 +249,19 @@ describe('mobile prompt composer', () => {
|
|||||||
expect(app._sendInputAsync).toHaveBeenLastCalledWith('session-1', '\r', { useMux: true });
|
expect(app._sendInputAsync).toHaveBeenLastCalledWith('session-1', '\r', { useMux: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('releases echo passthrough after a composed prompt is queued', () => {
|
||||||
|
const { app, bar, document } = loadComposer();
|
||||||
|
app._echoPassthroughSessions.add('session-1');
|
||||||
|
app._echoPassthroughSessions.add('session-2');
|
||||||
|
bar.composePrompt();
|
||||||
|
textarea(document).value = 'send from composer';
|
||||||
|
|
||||||
|
(document.querySelector('.paste-send') as HTMLButtonElement).click();
|
||||||
|
|
||||||
|
expect(app._echoPassthroughSessions.has('session-1')).toBe(false);
|
||||||
|
expect(app._echoPassthroughSessions.has('session-2')).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('preserves the draft and focuses xterm when Use terminal keyboard is chosen', () => {
|
it('preserves the draft and focuses xterm when Use terminal keyboard is chosen', () => {
|
||||||
const { app, bar, document, localEcho, runTimers } = loadComposer();
|
const { app, bar, document, localEcho, runTimers } = loadComposer();
|
||||||
const composeButton = mountComposeButton(bar, document);
|
const composeButton = mountComposeButton(bar, document);
|
||||||
|
|||||||
Reference in New Issue
Block a user