@@ -323,8 +323,15 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
323323 // Handle clipboard image pasting with Ctrl+V
324324 const handleClipboardPaste = useCallback ( async ( ) => {
325325 try {
326- if ( await clipboardHasImage ( ) ) {
326+ console . log ( '[DEBUG] Ctrl+V pressed - checking for clipboard image...' ) ;
327+ const hasImage = await clipboardHasImage ( ) ;
328+ console . log ( '[DEBUG] Clipboard has image:' , hasImage ) ;
329+
330+ if ( hasImage ) {
331+ console . log ( '[DEBUG] Attempting to save clipboard image...' ) ;
327332 const imagePath = await saveClipboardImage ( config . getTargetDir ( ) ) ;
333+ console . log ( '[DEBUG] Image saved to:' , imagePath ) ;
334+
328335 if ( imagePath ) {
329336 // Clean up old images
330337 cleanupOldClipboardImages ( config . getTargetDir ( ) ) . catch ( ( ) => {
@@ -333,6 +340,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
333340
334341 // Get relative path from current directory
335342 const relativePath = path . relative ( config . getTargetDir ( ) , imagePath ) ;
343+ console . log ( '[DEBUG] Relative path:' , relativePath ) ;
336344
337345 // Insert @path reference at cursor position
338346 const insertText = `@${ relativePath } ` ;
@@ -352,17 +360,28 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
352360 textToInsert = textToInsert + ' ' ;
353361 }
354362
363+ console . log ( '[DEBUG] Inserting text:' , textToInsert ) ;
355364 // Insert at cursor position
356365 buffer . replaceRangeByOffset ( offset , offset , textToInsert ) ;
366+ console . log ( '[DEBUG] Image path inserted successfully!' ) ;
357367 return ;
368+ } else {
369+ console . log ( '[DEBUG] Failed to save clipboard image' ) ;
358370 }
371+ } else {
372+ console . log ( '[DEBUG] No image in clipboard, pasting text instead...' ) ;
359373 }
360374
361375 const textToInsert = await clipboardy . read ( ) ;
376+ console . log ( '[DEBUG] Pasting text from clipboard' ) ;
362377 const offset = buffer . getOffset ( ) ;
363378 buffer . replaceRangeByOffset ( offset , offset , textToInsert ) ;
364379 } catch ( error ) {
365- console . error ( 'Error handling clipboard image:' , error ) ;
380+ console . error ( '[ERROR] Error handling clipboard paste:' , error ) ;
381+ console . error (
382+ '[ERROR] Stack trace:' ,
383+ error instanceof Error ? error . stack : 'No stack trace' ,
384+ ) ;
366385 }
367386 } , [ buffer , config ] ) ;
368387
0 commit comments