@@ -10,10 +10,12 @@ use std::collections::VecDeque;
1010use std:: { rc:: Rc , time:: Instant } ;
1111use tokio:: sync:: mpsc:: { self , UnboundedReceiver } ;
1212
13+ use crate :: utils:: { get_styled_line, get_styled_spans} ;
1314use crate :: widgets:: history:: { BottomPane , MessageItem } ;
1415use crate :: { ResponseEvent , Responsive , TuiEvent } ;
1516
16- const FOOTER_APP_VERSION : & str = concat ! ( " b4n v" , env!( "CARGO_PKG_VERSION" ) , " " ) ;
17+ const FOOTER_APP_VERSION : & str = concat ! ( " b4n ␝v␝" , env!( "CARGO_PKG_VERSION" ) , " " ) ;
18+ const FOOTER_APP_VERSION_LEN : usize = FOOTER_APP_VERSION . len ( ) - 4 ;
1719const MESSAGE_HISTORY_SIZE : usize = 20 ;
1820
1921/// Footer widget.
@@ -154,8 +156,8 @@ impl Footer {
154156 . split ( area) ;
155157
156158 if draw_hint && let Some ( hint) = & self . hint {
157- let style = Style :: new ( ) . fg ( colors. footer . text . dim ) . bg ( colors . footer . text . bg ) ;
158- frame. render_widget ( Paragraph :: new ( Line :: styled ( hint , style ) ) , layout[ 1 ] ) ;
159+ let line = get_styled_line ( hint , colors. footer . hint ) ;
160+ frame. render_widget ( Paragraph :: new ( line ) , layout[ 1 ] ) ;
159161 } else {
160162 frame. render_widget ( Block :: new ( ) . style ( & colors. footer . text ) , layout[ 1 ] ) ;
161163 }
@@ -174,7 +176,7 @@ impl Footer {
174176 fn get_hint_length ( & self ) -> u16 {
175177 self . hint
176178 . as_deref ( )
177- . map ( |h| h. chars ( ) . count ( ) )
179+ . map ( |h| h. chars ( ) . filter ( |ch| * ch != '␝' ) . count ( ) )
178180 . and_then ( |l| u16:: try_from ( l) . ok ( ) )
179181 . unwrap_or_default ( )
180182 }
@@ -295,11 +297,11 @@ impl Footer {
295297 let width = usize:: from ( width) ;
296298 let mut rendered = 0 ;
297299 let mut spans = Vec :: with_capacity ( 10 ) ;
298- let mut total = FOOTER_APP_VERSION . len ( ) ;
300+ let mut total = FOOTER_APP_VERSION_LEN ;
299301
300302 spans. push ( Span :: styled ( "" , Style :: new ( ) . fg ( colors. footer . text . bg ) . bg ( colors. text . bg ) ) ) ;
301303 spans. push ( Span :: styled ( " " , & colors. footer . text ) ) ;
302- spans. push ( Span :: styled ( FOOTER_APP_VERSION , & colors. footer . text ) ) ;
304+ spans. extend ( get_styled_spans ( FOOTER_APP_VERSION , colors. footer . text ) ) ;
303305
304306 if self . show_trail && !self . trail . is_empty ( ) {
305307 spans. push ( Span :: styled ( " " , & colors. footer . text ) ) ;
0 commit comments