fix(native-chat): keep consecutive image frames bare

This commit is contained in:
Brennan Benson
2026-08-27 00:52:46 -07:00
parent efda0e5c49
commit 2c40d52606
3 changed files with 5 additions and 5 deletions
@@ -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~ '
])
})
@@ -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}`)
})
})
+1 -1
View File
@@ -19,7 +19,7 @@ export function imagePasteWritesFollowedByText(
return framedImagePastes.map((paste, index) =>
separateImagePasteFromFollowingText(
paste,
index < framedImagePastes.length - 1 || followedByText
index === framedImagePastes.length - 1 && followedByText
)
)
}