mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 11:04:42 -07:00
fix: resolve infinite loop when using 'Modify with external editor' (#17453)
Co-authored-by: Jack Wotherspoon <jackwoth@google.com> Co-authored-by: ehedlund <ehedlund@google.com>
This commit is contained in:
@@ -13,8 +13,10 @@ import { MessageType } from '../types.js';
|
||||
import type { EditorType } from '@google/gemini-cli-core';
|
||||
import {
|
||||
allowEditorTypeInSandbox,
|
||||
checkHasEditorType,
|
||||
hasValidEditorCommand,
|
||||
getEditorDisplayName,
|
||||
coreEvents,
|
||||
CoreEvent,
|
||||
} from '@google/gemini-cli-core';
|
||||
import type { UseHistoryManagerReturn } from './useHistoryManager.js';
|
||||
|
||||
@@ -45,7 +47,7 @@ export const useEditorSettings = (
|
||||
(editorType: EditorType | undefined, scope: LoadableSettingScope) => {
|
||||
if (
|
||||
editorType &&
|
||||
(!checkHasEditorType(editorType) ||
|
||||
(!hasValidEditorCommand(editorType) ||
|
||||
!allowEditorTypeInSandbox(editorType))
|
||||
) {
|
||||
return;
|
||||
@@ -66,6 +68,7 @@ export const useEditorSettings = (
|
||||
);
|
||||
setEditorError(null);
|
||||
setIsEditorDialogOpen(false);
|
||||
coreEvents.emit(CoreEvent.EditorSelected, { editor: editorType });
|
||||
} catch (error) {
|
||||
setEditorError(`Failed to set editor preference: ${error}`);
|
||||
}
|
||||
@@ -75,6 +78,7 @@ export const useEditorSettings = (
|
||||
|
||||
const exitEditorDialog = useCallback(() => {
|
||||
setIsEditorDialogOpen(false);
|
||||
coreEvents.emit(CoreEvent.EditorSelected, { editor: undefined });
|
||||
}, []);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user