From 2c40d52606aaa50807b3ab422692e0f43a74ec47 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 27 Aug 2026 00:23:52 -0700 Subject: [PATCH] fix(native-chat): keep consecutive image frames bare --- .../components/native-chat/native-chat-runtime-send.test.ts | 2 +- src/shared/image-paste-following-text.test.ts | 6 +++--- src/shared/image-paste-following-text.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/components/native-chat/native-chat-runtime-send.test.ts b/src/renderer/src/components/native-chat/native-chat-runtime-send.test.ts index b4c955a0d60..5f054b6db65 100644 --- a/src/renderer/src/components/native-chat/native-chat-runtime-send.test.ts +++ b/src/renderer/src/components/native-chat/native-chat-runtime-send.test.ts @@ -374,7 +374,7 @@ describe('sendNativeChatMessageWithImageAttachments', () => { expectWriteOrder(sendRuntimePtyInput.mock.calls, [ NATIVE_CHAT_CLEAR_UNSUBMITTED_INPUT, - '\x1b[200~/tmp/a.png\x1b[201~ ', + '\x1b[200~/tmp/a.png\x1b[201~', '\x1b[200~/tmp/b.png\x1b[201~ ' ]) }) diff --git a/src/shared/image-paste-following-text.test.ts b/src/shared/image-paste-following-text.test.ts index c27a8a7d9f6..068c3876a6b 100644 --- a/src/shared/image-paste-following-text.test.ts +++ b/src/shared/image-paste-following-text.test.ts @@ -25,10 +25,10 @@ describe('joinImagePastesAndPrompt', () => { expect(joinImagePastesAndPrompt([], PROMPT)).toBe(PROMPT) }) - it('separates multiple attachments from each other and from the prompt', () => { + it('keeps back-to-back image frames bare and separates only the final frame from prompt text', () => { expect(joinImagePastesAndPrompt([IMAGE_A, IMAGE_B], PROMPT)).toBe( - `${IMAGE_A} ${IMAGE_B} ${PROMPT}` + `${IMAGE_A}${IMAGE_B} ${PROMPT}` ) - expect(joinImagePastesAndPrompt([IMAGE_A, IMAGE_B], '')).toBe(`${IMAGE_A} ${IMAGE_B}`) + expect(joinImagePastesAndPrompt([IMAGE_A, IMAGE_B], '')).toBe(`${IMAGE_A}${IMAGE_B}`) }) }) diff --git a/src/shared/image-paste-following-text.ts b/src/shared/image-paste-following-text.ts index a5cd79af222..22afbd1df76 100644 --- a/src/shared/image-paste-following-text.ts +++ b/src/shared/image-paste-following-text.ts @@ -19,7 +19,7 @@ export function imagePasteWritesFollowedByText( return framedImagePastes.map((paste, index) => separateImagePasteFromFollowingText( paste, - index < framedImagePastes.length - 1 || followedByText + index === framedImagePastes.length - 1 && followedByText ) ) }