@@ -283,12 +283,20 @@ fn draw_file_actions_modal(f: &mut Frame, file_name: &str, file_type: &str, sele
283283 Style :: default ( ) . bg ( MODAL_BG ) . fg ( Color :: DarkGray ) ,
284284 )
285285 } ;
286+ let cursor_text = format ! ( " {} " , cursor) ;
287+ let key_text = format ! ( "[{}] " , key) ;
288+ let label_text = label. to_string ( ) ;
289+ let content_width = cursor_text. chars ( ) . count ( )
290+ + key_text. chars ( ) . count ( )
291+ + label_text. chars ( ) . count ( ) ;
292+ let pad_width = inner. width . saturating_sub ( content_width as u16 ) as usize ;
293+
286294 ListItem :: new ( Line :: from ( vec ! [
287- Span :: styled( format! ( " {} " , cursor ) , row_style) ,
288- Span :: styled( format! ( "[{}] " , key ) , key_style) ,
289- Span :: styled( label . to_string ( ) , row_style) ,
295+ Span :: styled( cursor_text , row_style) ,
296+ Span :: styled( key_text , key_style) ,
297+ Span :: styled( label_text , row_style) ,
290298 // Fill the rest of the row so the highlight spans the full width
291- Span :: styled( " " . repeat( 30 ) , row_style) ,
299+ Span :: styled( " " . repeat( pad_width ) , row_style) ,
292300 ] ) )
293301 } )
294302 . collect ( ) ;
0 commit comments