File tree Expand file tree Collapse file tree
packages/opencode/src/cli/cmd/tui/component/prompt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -731,6 +731,23 @@ export function Prompt(props: PromptProps) {
731731 e . preventDefault ( )
732732 return
733733 }
734+ // Handle clipboard paste (Ctrl+V) - check for images first on Windows
735+ // This is needed because Windows terminal doesn't properly send image data
736+ // through bracketed paste, so we need to intercept the keypress and
737+ // directly read from clipboard before the terminal handles it
738+ if ( keybind . match ( "input_paste" , e ) ) {
739+ const content = await Clipboard . read ( )
740+ if ( content ?. mime . startsWith ( "image/" ) ) {
741+ e . preventDefault ( )
742+ await pasteImage ( {
743+ filename : "clipboard" ,
744+ mime : content . mime ,
745+ content : content . data ,
746+ } )
747+ return
748+ }
749+ // If no image, let the default paste behavior continue
750+ }
734751 if ( keybind . match ( "input_clear" , e ) && store . prompt . input !== "" ) {
735752 input . clear ( )
736753 input . extmarks . clear ( )
You can’t perform that action at this time.
0 commit comments