The open source coding agent.
TypeScript
fix(opencode): update pasteImage to only increment count when the previous attachment is an image too (#14173)
OpeOginnibe2e6f192617
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsxindex cefef208de4..4114daf6c63 100644--- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx@@ -694,7 +694,7 @@ export function Prompt(props: PromptProps) {async function pasteImage(file: { filename?: string; content: string; mime: string }) {const currentOffset = input.visualCursor.offsetconst extmarkStart = currentOffset- const count = store.prompt.parts.filter((x) => x.type === "file").length+ const count = store.prompt.parts.filter((x) => x.type === "file" && x.mime.startsWith("image/")).lengthconst virtualText = `[Image ${count + 1}]`const extmarkEnd = extmarkStart + virtualText.lengthconst textToInsert = virtualText + " "