File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -3848,8 +3848,15 @@ impl ChatWidget {
38483848 /// quit.
38493849 fn on_ctrl_c ( & mut self ) {
38503850 let key = key_hint:: ctrl ( KeyCode :: Char ( 'c' ) ) ;
3851+ let modal_or_popup_active = !self . bottom_pane . no_modal_or_popup_active ( ) ;
38513852 if self . bottom_pane . on_ctrl_c ( ) == CancellationEvent :: Handled {
3852- self . arm_quit_shortcut ( key) ;
3853+ if modal_or_popup_active {
3854+ self . quit_shortcut_expires_at = None ;
3855+ self . quit_shortcut_key = None ;
3856+ self . bottom_pane . clear_quit_shortcut_hint ( ) ;
3857+ } else {
3858+ self . arm_quit_shortcut ( key) ;
3859+ }
38533860 return ;
38543861 }
38553862
Original file line number Diff line number Diff line change @@ -3551,8 +3551,15 @@ impl ChatWidget {
35513551 /// quit.
35523552 fn on_ctrl_c ( & mut self ) {
35533553 let key = key_hint:: ctrl ( KeyCode :: Char ( 'c' ) ) ;
3554+ let modal_or_popup_active = !self . bottom_pane . no_modal_or_popup_active ( ) ;
35543555 if self . bottom_pane . on_ctrl_c ( ) == CancellationEvent :: Handled {
3555- self . arm_quit_shortcut ( key) ;
3556+ if modal_or_popup_active {
3557+ self . quit_shortcut_expires_at = None ;
3558+ self . quit_shortcut_key = None ;
3559+ self . bottom_pane . clear_quit_shortcut_hint ( ) ;
3560+ } else {
3561+ self . arm_quit_shortcut ( key) ;
3562+ }
35563563 return ;
35573564 }
35583565
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ Priority order in the UI layer:
3535
36361 . Active modal/view gets the first chance to consume (` BottomPane::on_ctrl_c ` ).
3737 - If the modal handles it, the quit flow stops.
38+ - When a modal/popup handles Ctrl+C, the quit shortcut is cleared so dismissing a modal cannot
39+ accidentally prime a subsequent Ctrl+C to quit.
38402 . If the user has already armed Ctrl+C and the 1 second window has not expired, the second Ctrl+C
3941 triggers shutdown-first quit immediately.
40423 . Otherwise, ` ChatWidget ` arms Ctrl+C and shows the quit hint (` ctrl + c again to quit ` ) for
You can’t perform that action at this time.
0 commit comments