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 cefef208de4a..d048e01f66cb 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -834,14 +834,13 @@ 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 + // Handle clipboard paste (Ctrl+V) + // Directly read from clipboard to ensure paste works across all platforms + // including Windows terminals which may not properly send bracketed paste if (keybind.match("input_paste", e)) { + e.preventDefault() const content = await Clipboard.read() if (content?.mime.startsWith("image/")) { - e.preventDefault() await pasteImage({ filename: "clipboard", mime: content.mime, @@ -849,7 +848,10 @@ export function Prompt(props: PromptProps) { }) return } - // If no image, let the default paste behavior continue + if (content?.mime === "text/plain" && content.data) { + input.insertText(content.data) + return + } } if (keybind.match("input_clear", e) && store.prompt.input !== "") { input.clear()