The open source coding agent.
TypeScript
fix: support clipboard image paste (Ctrl+V) on Windows (#5919)
Neil Daquioag2062247e72f7
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsxindex 99a90ab46ac..a892c83daf8 100644--- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx@@ -731,6 +731,23 @@ export function Prompt(props: PromptProps) {e.preventDefault()return}+ // Handle clipboard paste (Ctrl+V) - check for images first on Windows+ // This is needed because Windows terminal doesn't properly send image data+ // through bracketed paste, so we need to intercept the keypress and+ // directly read from clipboard before the terminal handles it+ if (keybind.match("input_paste", e)) {+ const content = await Clipboard.read()+ if (content?.mime.startsWith("image/")) {+ e.preventDefault()+ await pasteImage({+ filename: "clipboard",+ mime: content.mime,+ content: content.data,+ })+ return+ }+ // If no image, let the default paste behavior continue+ }if (keybind.match("input_clear", e) && store.prompt.input !== "") {input.clear()input.extmarks.clear()