@@ -254,13 +254,13 @@ impl Model {
254254 self . selected_agent_index = self . agent_selection_list . selected_index ( ) ;
255255 self . show_agent_router = false ;
256256 self . error_message = None ;
257- self . textarea = create_textarea ( ) ;
257+ self . clear_textarea ( ) ;
258258 }
259259
260260 Message :: ExitInputMode => {
261261 // Close the agent router overlay if open
262262 self . show_agent_router = false ;
263- self . textarea = create_textarea ( ) ;
263+ self . clear_textarea ( ) ;
264264 }
265265
266266 Message :: KeyPress ( key) => {
@@ -279,7 +279,7 @@ impl Model {
279279 let user_text = self . textarea . text ( ) . to_string ( ) ;
280280 if !user_text. trim ( ) . is_empty ( ) {
281281 // Clear textarea immediately after capturing text
282- self . textarea = create_textarea ( ) ;
282+ self . clear_textarea ( ) ;
283283 self . response_events
284284 . push ( ConversationEvent :: UserMessage { text : user_text } ) ;
285285 self . current_mode = AppMode :: Streaming ;
@@ -423,7 +423,7 @@ impl Model {
423423 match self . last_ctrl_c_time {
424424 None => {
425425 // First Ctrl-C: clear textarea and show hint
426- self . textarea = create_textarea ( ) ;
426+ self . clear_textarea ( ) ;
427427 self . last_ctrl_c_time = Some ( now) ;
428428 self . error_message = Some ( "Press Ctrl-C again to exit" . to_string ( ) ) ;
429429 }
@@ -434,7 +434,7 @@ impl Model {
434434 }
435435 Some ( _) => {
436436 // Ctrl-C after timeout expired: treat as first press
437- self . textarea = create_textarea ( ) ;
437+ self . clear_textarea ( ) ;
438438 self . last_ctrl_c_time = Some ( now) ;
439439 self . error_message = Some ( "Press Ctrl-C again to exit" . to_string ( ) ) ;
440440 }
@@ -480,7 +480,7 @@ impl Model {
480480 . with_footer_hint ( standard_popup_hint_line ( ) ) ;
481481 self . autocomplete_selection_list = SelectionList :: new ( config, vec ! [ ] , Box :: new ( ( ) ) ) ;
482482 // self.autocomplete_filtered_commands.clear();
483- self . textarea = create_textarea ( ) ;
483+ self . clear_textarea ( ) ;
484484 }
485485
486486 Message :: Quit => {
@@ -499,6 +499,10 @@ impl Model {
499499 }
500500 }
501501
502+ pub fn clear_textarea ( & mut self ) {
503+ self . textarea = create_textarea ( ) ;
504+ }
505+
502506 pub fn inline_wrap_width ( & self ) -> usize {
503507 self . terminal_size . 0 . saturating_sub ( 2 ) . max ( 1 ) as usize
504508 }
0 commit comments