diff options
| author | JAYADITYA <[email protected]> | 2025-08-12 09:43:57 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-12 04:13:57 +0000 |
| commit | 2d1a6af890da1e9437cd1a1774e2c7fc7ad32957 (patch) | |
| tree | 841a9d59013793e2f6485d8e2fe87a2e7328373b /packages/cli/src/ui/App.tsx | |
| parent | f9efb2e24f41d8738d6ea8d1b8e8be2dff3bb83b (diff) | |
feat(cli): support single Ctrl+C to cancel streaming, preserving double Ctrl+C to exit (#5838)
Diffstat (limited to 'packages/cli/src/ui/App.tsx')
| -rw-r--r-- | packages/cli/src/ui/App.tsx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index c4f67294..e952d6b2 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -545,6 +545,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { initError, pendingHistoryItems: pendingGeminiHistoryItems, thought, + cancelOngoingRequest, } = useGeminiStream( config.getGeminiClient(), history, @@ -655,6 +656,9 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { if (isAuthenticating) { return; } + if (!ctrlCPressedOnce) { + cancelOngoingRequest?.(); + } handleExit(ctrlCPressedOnce, setCtrlCPressedOnce, ctrlCTimerRef); } else if (keyMatchers[Command.EXIT](key)) { if (buffer.text.length > 0) { @@ -686,6 +690,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { ctrlDTimerRef, handleSlashCommand, isAuthenticating, + cancelOngoingRequest, ], ); |
