@@ -36,7 +36,6 @@ import {
3636 cleanupOldClipboardImages ,
3737} from '../utils/clipboardUtils.js' ;
3838import * as path from 'node:path' ;
39- import * as fs from 'node:fs' ;
4039import { SCREEN_READER_USER_PREFIX } from '../textConstants.js' ;
4140import { useShellFocusState } from '../contexts/ShellFocusContext.js' ;
4241import { useUIState } from '../contexts/UIStateContext.js' ;
@@ -323,22 +322,9 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
323322
324323 // Handle clipboard image pasting with Ctrl+V
325324 const handleClipboardPaste = useCallback ( async ( ) => {
326- const debugLog = ( msg : string ) => {
327- const logPath = path . join ( config . getTargetDir ( ) , '.gemini-debug.log' ) ;
328- const timestamp = new Date ( ) . toISOString ( ) ;
329- fs . appendFileSync ( logPath , `${ timestamp } ${ msg } \n` ) ;
330- } ;
331-
332325 try {
333- debugLog ( '[DEBUG] Ctrl+V pressed - checking for clipboard image...' ) ;
334- const hasImage = await clipboardHasImage ( ) ;
335- debugLog ( `[DEBUG] Clipboard has image: ${ hasImage } ` ) ;
336-
337- if ( hasImage ) {
338- debugLog ( '[DEBUG] Attempting to save clipboard image...' ) ;
326+ if ( await clipboardHasImage ( ) ) {
339327 const imagePath = await saveClipboardImage ( config . getTargetDir ( ) ) ;
340- debugLog ( `[DEBUG] Image saved to: ${ imagePath } ` ) ;
341-
342328 if ( imagePath ) {
343329 // Clean up old images
344330 cleanupOldClipboardImages ( config . getTargetDir ( ) ) . catch ( ( ) => {
@@ -347,7 +333,6 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
347333
348334 // Get relative path from current directory
349335 const relativePath = path . relative ( config . getTargetDir ( ) , imagePath ) ;
350- debugLog ( `[DEBUG] Relative path: ${ relativePath } ` ) ;
351336
352337 // Insert @path reference at cursor position
353338 const insertText = `@${ relativePath } ` ;
@@ -367,27 +352,17 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
367352 textToInsert = textToInsert + ' ' ;
368353 }
369354
370- debugLog ( `[DEBUG] Inserting text: ${ textToInsert } ` ) ;
371355 // Insert at cursor position
372356 buffer . replaceRangeByOffset ( offset , offset , textToInsert ) ;
373- debugLog ( '[DEBUG] Image path inserted successfully!' ) ;
374357 return ;
375- } else {
376- debugLog ( '[DEBUG] Failed to save clipboard image' ) ;
377358 }
378- } else {
379- debugLog ( '[DEBUG] No image in clipboard, pasting text instead...' ) ;
380359 }
381360
382361 const textToInsert = await clipboardy . read ( ) ;
383- debugLog ( '[DEBUG] Pasting text from clipboard' ) ;
384362 const offset = buffer . getOffset ( ) ;
385363 buffer . replaceRangeByOffset ( offset , offset , textToInsert ) ;
386364 } catch ( error ) {
387- debugLog ( `[ERROR] Error handling clipboard paste: ${ error } ` ) ;
388- debugLog (
389- `[ERROR] Stack trace: ${ error instanceof Error ? error . stack : 'No stack trace' } ` ,
390- ) ;
365+ console . error ( 'Error handling clipboard paste:' , error ) ;
391366 }
392367 } , [ buffer , config ] ) ;
393368
0 commit comments