@@ -18,7 +18,7 @@ import { usePromptStash } from "./stash"
1818import { DialogStash } from "../dialog-stash"
1919import { type AutocompleteRef , Autocomplete } from "./autocomplete"
2020import { useCommandDialog } from "../dialog-command"
21- import { useRenderer } from "@opentui/solid"
21+ import { useKeyboard , useRenderer } from "@opentui/solid"
2222import { Editor } from "@tui/util/editor"
2323import { useExit } from "../../context/exit"
2424import { Clipboard } from "../../util/clipboard"
@@ -356,6 +356,20 @@ export function Prompt(props: PromptProps) {
356356 ]
357357 } )
358358
359+ // Windows Terminal 1.25+ handles Ctrl+V on keydown when kitty events are
360+ // enabled, but still reports the kitty key-release event. Probe on release.
361+ if ( process . platform === "win32" ) {
362+ useKeyboard (
363+ ( evt ) => {
364+ if ( ! input . focused ) return
365+ if ( evt . name === "v" && evt . ctrl && evt . eventType === "release" ) {
366+ command . trigger ( "prompt.paste" )
367+ }
368+ } ,
369+ { release : true } ,
370+ )
371+ }
372+
359373 const ref : PromptRef = {
360374 get focused ( ) {
361375 return input . focused
@@ -850,10 +864,9 @@ export function Prompt(props: PromptProps) {
850864 e . preventDefault ( )
851865 return
852866 }
853- // Handle clipboard paste (Ctrl+V) - check for images first on Windows
854- // This is needed because Windows terminal doesn't properly send image data
855- // through bracketed paste, so we need to intercept the keypress and
856- // directly read from clipboard before the terminal handles it
867+ // Check clipboard for images before terminal-handled paste runs.
868+ // This helps terminals that forward Ctrl+V to the app; Windows
869+ // Terminal 1.25+ usually handles Ctrl+V before this path.
857870 if ( keybind . match ( "input_paste" , e ) ) {
858871 const content = await Clipboard . read ( )
859872 if ( content ?. mime . startsWith ( "image/" ) ) {
@@ -936,6 +949,9 @@ export function Prompt(props: PromptProps) {
936949 // Replace CRLF first, then any remaining CR
937950 const normalizedText = decodePasteBytes ( event . bytes ) . replace ( / \r \n / g, "\n" ) . replace ( / \r / g, "\n" )
938951 const pastedContent = normalizedText . trim ( )
952+
953+ // Windows Terminal <1.25 can surface image-only clipboard as an
954+ // empty bracketed paste. Windows Terminal 1.25+ does not.
939955 if ( ! pastedContent ) {
940956 command . trigger ( "prompt.paste" )
941957 return
0 commit comments