@@ -25,6 +25,8 @@ pub(crate) struct StatusIndicatorWidget {
2525 header : String ,
2626 /// Queued user messages to display under the status line.
2727 queued_messages : Vec < String > ,
28+ /// Whether to show the interrupt hint (Esc).
29+ show_interrupt_hint : bool ,
2830
2931 elapsed_running : Duration ,
3032 last_resume_at : Instant ,
@@ -55,6 +57,7 @@ impl StatusIndicatorWidget {
5557 Self {
5658 header : String :: from ( "Working" ) ,
5759 queued_messages : Vec :: new ( ) ,
60+ show_interrupt_hint : true ,
5861 elapsed_running : Duration :: ZERO ,
5962 last_resume_at : Instant :: now ( ) ,
6063 is_paused : false ,
@@ -98,16 +101,23 @@ impl StatusIndicatorWidget {
98101
99102 /// Update the animated header label (left of the brackets).
100103 pub ( crate ) fn update_header ( & mut self , header : String ) {
101- if self . header != header {
102- self . header = header;
103- }
104+ self . header = header;
105+ }
106+
107+ pub ( crate ) fn set_interrupt_hint_visible ( & mut self , visible : bool ) {
108+ self . show_interrupt_hint = visible;
104109 }
105110
106111 #[ cfg( test) ]
107112 pub ( crate ) fn header ( & self ) -> & str {
108113 & self . header
109114 }
110115
116+ #[ cfg( test) ]
117+ pub ( crate ) fn interrupt_hint_visible ( & self ) -> bool {
118+ self . show_interrupt_hint
119+ }
120+
111121 /// Replace the queued messages displayed beneath the header.
112122 pub ( crate ) fn set_queued_messages ( & mut self , queued : Vec < String > ) {
113123 self . queued_messages = queued;
@@ -175,12 +185,16 @@ impl WidgetRef for StatusIndicatorWidget {
175185 spans. push ( spinner ( Some ( self . last_resume_at ) ) ) ;
176186 spans. push ( " " . into ( ) ) ;
177187 spans. extend ( shimmer_spans ( & self . header ) ) ;
178- spans. extend ( vec ! [
179- " " . into( ) ,
180- format!( "({pretty_elapsed} • " ) . dim( ) ,
181- key_hint:: plain( KeyCode :: Esc ) . into( ) ,
182- " to interrupt)" . dim( ) ,
183- ] ) ;
188+ spans. push ( " " . into ( ) ) ;
189+ if self . show_interrupt_hint {
190+ spans. extend ( vec ! [
191+ format!( "({pretty_elapsed} • " ) . dim( ) ,
192+ key_hint:: plain( KeyCode :: Esc ) . into( ) ,
193+ " to interrupt)" . dim( ) ,
194+ ] ) ;
195+ } else {
196+ spans. push ( format ! ( "({pretty_elapsed})" ) . dim ( ) ) ;
197+ }
184198
185199 // Build lines: status, then queued messages, then spacer.
186200 let mut lines: Vec < Line < ' static > > = Vec :: new ( ) ;
0 commit comments