mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
fix(cli): prevent Ctrl+D exit when input buffer is not empty (#23306)
Co-authored-by: wtanaka.com <wtanaka@users.noreply.github.com>
This commit is contained in:
@@ -2157,13 +2157,8 @@ describe('AppContainer State Management', () => {
|
|||||||
expect(mockHandleSlashCommand).not.toHaveBeenCalled();
|
expect(mockHandleSlashCommand).not.toHaveBeenCalled();
|
||||||
|
|
||||||
pressKey('\x04'); // Ctrl+D
|
pressKey('\x04'); // Ctrl+D
|
||||||
// Now count is 2, it should quit.
|
// It should still not quit because buffer is non-empty.
|
||||||
expect(mockHandleSlashCommand).toHaveBeenCalledWith(
|
expect(mockHandleSlashCommand).not.toHaveBeenCalled();
|
||||||
'/quit',
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1702,6 +1702,10 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
|||||||
handleCtrlCPress();
|
handleCtrlCPress();
|
||||||
return true;
|
return true;
|
||||||
} else if (keyMatchers[Command.EXIT](key)) {
|
} else if (keyMatchers[Command.EXIT](key)) {
|
||||||
|
// If the input field is non-empty, do not exit.
|
||||||
|
if (bufferRef.current.text.length > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
handleCtrlDPress();
|
handleCtrlDPress();
|
||||||
return true;
|
return true;
|
||||||
} else if (keyMatchers[Command.SUSPEND_APP](key)) {
|
} else if (keyMatchers[Command.SUSPEND_APP](key)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user