@@ -18,6 +18,7 @@ use ratatui::text::Span;
1818use crate :: ansi_escape:: ansi_escape_line;
1919use crate :: app_command:: AppCommand ;
2020use crate :: app_event:: AppEvent ;
21+ use crate :: bottom_pane:: InputMode ;
2122use crate :: bottom_pane:: InputResult ;
2223use crate :: history_cell;
2324use crate :: history_cell:: PlainHistoryCell ;
@@ -87,6 +88,7 @@ impl ChatWidget {
8788 text_elements,
8889 local_images,
8990 mention_bindings,
91+ input_mode,
9092 interaction_mode,
9193 } => {
9294 let user_message = UserMessage {
@@ -100,6 +102,7 @@ impl ChatWidget {
100102 // Turn is active — show in bottom pane as pending cell.
101103 self . bottom_pane
102104 . push_pending_cell ( user_message. text . clone ( ) ) ;
105+ self . queued_input_modes . push_back ( input_mode) ;
103106 self . queued_count += 1 ;
104107 self . app_event_tx . send ( AppEvent :: Command (
105108 AppCommand :: user_turn_with_interaction_mode (
@@ -114,13 +117,14 @@ impl ChatWidget {
114117 ) ) ;
115118 self . set_status_message ( "Message queued" ) ;
116119 } else {
117- self . submit_user_message_with_interaction_mode ( user_message, interaction_mode) ;
120+ self . submit_user_message_with_modes ( user_message, interaction_mode, input_mode ) ;
118121 }
119122 }
120123 InputResult :: ShellCommand { command } => {
121124 if self . busy {
122125 self . set_status_message ( "Cannot run shell command while generating" ) ;
123126 } else {
127+ self . current_turn_mode = InputMode :: Shell ;
124128 self . app_event_tx
125129 . send ( AppEvent :: Command ( AppCommand :: execute_shell_command (
126130 command,
@@ -132,6 +136,7 @@ impl ChatWidget {
132136 if self . busy {
133137 self . set_status_message ( "Cannot run shell command while generating" ) ;
134138 } else {
139+ self . current_turn_mode = InputMode :: Shell ;
135140 self . app_event_tx
136141 . send ( AppEvent :: Command ( AppCommand :: submit_shell_input ( command) ) ) ;
137142 self . set_status_message ( "Shell command submitted" ) ;
@@ -215,9 +220,7 @@ impl ChatWidget {
215220 self . set_status_message ( "Persistent composer history is not available" ) ;
216221 }
217222 AppEvent :: ClearTranscript => {
218- self . history . clear ( ) ;
219- self . next_history_flush_index = 0 ;
220- self . frame_requester . schedule_frame ( ) ;
223+ self . clear_transcript_view ( ) ;
221224 }
222225 AppEvent :: Interrupt => self . set_status_message ( "Interrupted" ) ,
223226 AppEvent :: Command ( command) => {
@@ -282,18 +285,20 @@ impl ChatWidget {
282285 }
283286
284287 pub ( super ) fn submit_user_message ( & mut self , user_message : UserMessage ) {
285- self . submit_user_message_with_interaction_mode ( user_message, InteractionMode :: Build ) ;
288+ self . submit_user_message_with_modes ( user_message, InteractionMode :: Build , InputMode :: Build ) ;
286289 }
287290
288- pub ( super ) fn submit_user_message_with_interaction_mode (
291+ pub ( super ) fn submit_user_message_with_modes (
289292 & mut self ,
290293 user_message : UserMessage ,
291294 interaction_mode : InteractionMode ,
295+ input_mode : InputMode ,
292296 ) {
293297 if user_message. text . trim ( ) . is_empty ( ) {
294298 return ;
295299 }
296300
301+ self . current_turn_mode = input_mode;
297302 let local_image_paths = user_message
298303 . local_images
299304 . iter ( )
@@ -306,6 +311,7 @@ impl ChatWidget {
306311 local_image_paths,
307312 user_message. remote_image_urls . clone ( ) ,
308313 self . active_accent_color ( ) ,
314+ input_mode,
309315 ) ) ;
310316
311317 self . app_event_tx . send ( AppEvent :: Command (
0 commit comments