mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
feat: Implement delayed Ctrl+C exit prompt
This change introduces a small delay after the first Ctrl+C press, prompting the user to press Ctrl+C again to exit. This helps prevent accidental termination of the application.
- Added `exitOnCtrlC={false}` to the Ink render options in `gemini.tsx` to enable custom Ctrl+C handling.
- Implemented logic in `App.tsx` to:
- Display "Press Ctrl+C again to exit." for 2 seconds after the first Ctrl+C.
- Exit the application if Ctrl+C is pressed again during this period.
- Revert to normal operation if the second Ctrl+C is not pressed within the timeout.
- Defined a constant `CTRL_C_PROMPT_DURATION_MS` for the timeout duration.
This commit is contained in:
committed by
N. Taylor Mullen
parent
7012c86336
commit
1468047081
@@ -78,6 +78,7 @@ async function main() {
|
||||
startupWarnings={startupWarnings}
|
||||
/>
|
||||
</React.StrictMode>,
|
||||
{ exitOnCtrlC: false },
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user