@@ -3245,16 +3245,7 @@ impl ChatWidget {
32453245 // interrupted turn reaches the UI, so any unacknowledged steers still
32463246 // tracked here must be restored locally instead of waiting for a later commit.
32473247 if send_pending_steers_immediately {
3248- let pending_steers = self
3249- . pending_steers
3250- . drain ( ..)
3251- . map ( |pending| ( pending. user_message , pending. history_record ) )
3252- . collect :: < Vec < _ > > ( ) ;
3253- if !pending_steers. is_empty ( ) {
3254- let ( user_message, history_record) =
3255- merge_user_messages_with_history_record ( pending_steers) ;
3256- self . submit_user_message_with_history_record ( user_message, history_record) ;
3257- } else {
3248+ if !self . submit_pending_steers_immediately ( ) {
32583249 self . maybe_send_next_queued_input ( ) ;
32593250 }
32603251 } else if let Some ( combined) = self . drain_pending_messages_for_restore ( ) {
@@ -3265,6 +3256,23 @@ impl ChatWidget {
32653256 self . request_redraw ( ) ;
32663257 }
32673258
3259+ fn submit_pending_steers_immediately ( & mut self ) -> bool {
3260+ let pending_steers = self
3261+ . pending_steers
3262+ . drain ( ..)
3263+ . map ( |pending| ( pending. user_message , pending. history_record ) )
3264+ . collect :: < Vec < _ > > ( ) ;
3265+ if pending_steers. is_empty ( ) {
3266+ return false ;
3267+ }
3268+
3269+ let ( user_message, history_record) =
3270+ merge_user_messages_with_history_record ( pending_steers) ;
3271+ let submitted = self . submit_user_message_with_history_record ( user_message, history_record) ;
3272+ self . refresh_pending_input_preview ( ) ;
3273+ submitted
3274+ }
3275+
32683276 /// Merge pending steers, queued drafts, and the current composer state into a single message.
32693277 ///
32703278 /// Each pending message numbers attachments from `[Image #1]` relative to its own remote
@@ -5317,12 +5325,14 @@ impl ChatWidget {
53175325 && self . bottom_pane . no_modal_or_popup_active ( )
53185326 && !self . should_handle_vim_insert_escape ( key_event)
53195327 {
5320- self . submit_pending_steers_after_interrupt = true ;
53215328 if self . is_cancellable_work_active ( ) {
5329+ self . submit_pending_steers_after_interrupt = true ;
53225330 if !self . submit_op ( AppCommand :: interrupt ( ) ) {
53235331 self . submit_pending_steers_after_interrupt = false ;
53245332 }
5325- } else if !self . maybe_send_next_queued_input ( ) {
5333+ } else if !self . submit_pending_steers_immediately ( )
5334+ && !self . maybe_send_next_queued_input ( )
5335+ {
53265336 self . submit_pending_steers_after_interrupt = false ;
53275337 }
53285338 return ;
@@ -10797,6 +10807,10 @@ impl ChatWidget {
1079710807 self . bottom_pane . is_normal_backtrack_mode ( )
1079810808 }
1079910809
10810+ pub ( crate ) fn has_pending_or_queued_input ( & self ) -> bool {
10811+ !self . pending_steers . is_empty ( ) || self . has_queued_follow_up_messages ( )
10812+ }
10813+
1080010814 pub ( crate ) fn should_handle_vim_insert_escape ( & self , key_event : KeyEvent ) -> bool {
1080110815 self . bottom_pane
1080210816 . composer_should_handle_vim_insert_escape ( key_event)
0 commit comments