summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
index 99a90ab46..a892c83da 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()