@@ -13,6 +13,7 @@ import { LRUCache } from 'mnemonist';
1313import {
1414 coreEvents ,
1515 debugLogger ,
16+ getErrorMessage ,
1617 unescapePath ,
1718 type EditorType ,
1819} from '@google/gemini-cli-core' ;
@@ -30,6 +31,7 @@ import type { VimAction } from './vim-buffer-actions.js';
3031import { handleVimAction } from './vim-buffer-actions.js' ;
3132import { LRU_BUFFER_PERF_CACHE_LIMIT } from '../../constants.js' ;
3233import { openFileInEditor } from '../../utils/editorUtils.js' ;
34+ import { useSettings } from '../../contexts/SettingsContext.js' ;
3335import { useKeyMatchers } from '../../hooks/useKeyMatchers.js' ;
3436
3537export const LARGE_PASTE_LINE_THRESHOLD = 5 ;
@@ -2840,6 +2842,7 @@ export function useTextBuffer({
28402842 singleLine = false ,
28412843 getPreferredEditor,
28422844} : UseTextBufferProps ) : TextBuffer {
2845+ const settings = useSettings ( ) ;
28432846 const keyMatchers = useKeyMatchers ( ) ;
28442847 const initialState = useMemo ( ( ) : TextBufferState => {
28452848 const lines = initialText . split ( '\n' ) ;
@@ -3325,6 +3328,7 @@ export function useTextBuffer({
33253328 stdin ,
33263329 setRawMode ,
33273330 getPreferredEditor ?.( ) ,
3331+ settings . merged . general . openEditorInNewWindow ,
33283332 ) ;
33293333
33303334 let newText = fs . readFileSync ( filePath , 'utf8' ) ;
@@ -3342,11 +3346,7 @@ export function useTextBuffer({
33423346
33433347 dispatch ( { type : 'set_text' , payload : newText , pushToUndo : false } ) ;
33443348 } catch ( err ) {
3345- coreEvents . emitFeedback (
3346- 'error' ,
3347- '[useTextBuffer] external editor error' ,
3348- err ,
3349- ) ;
3349+ coreEvents . emitFeedback ( 'error' , getErrorMessage ( err ) , err ) ;
33503350 } finally {
33513351 try {
33523352 fs . unlinkSync ( filePath ) ;
@@ -3359,7 +3359,14 @@ export function useTextBuffer({
33593359 /* ignore */
33603360 }
33613361 }
3362- } , [ text , pastedContent , stdin , setRawMode , getPreferredEditor ] ) ;
3362+ } , [
3363+ text ,
3364+ pastedContent ,
3365+ stdin ,
3366+ setRawMode ,
3367+ getPreferredEditor ,
3368+ settings . merged . general . openEditorInNewWindow ,
3369+ ] ) ;
33633370
33643371 const handleInput = useCallback (
33653372 ( key : Key ) : boolean => {
0 commit comments