File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ impl App {
255255 self . focused_block = FocusedBlock :: PairedDevices ;
256256 }
257257
258- let adapter_block_height = self . controllers . len ( ) as u16 + 6 ;
258+ let adapter_block_height = self . controllers . len ( ) as u16 + 4 ;
259259
260260 let paired_devices_block_height = selected_controller. paired_devices . len ( ) as u16 + 4 ;
261261
@@ -576,6 +576,7 @@ impl App {
576576
577577 //New devices
578578
579+ let mut max_name_width = 20 ;
579580 if render_new_devices {
580581 let rows: Vec < Row > = selected_controller
581582 . new_devices
@@ -585,14 +586,20 @@ impl App {
585586 if let Some ( icon) = & d. icon {
586587 format!( "{} {}" , icon, & d. alias)
587588 } else {
589+ if d. alias. len( ) > max_name_width {
590+ max_name_width = d. alias. len( ) ;
591+ }
588592 d. alias. to_owned( )
589593 }
590594 } ] )
591595 } )
592596 . collect ( ) ;
593597 let rows_len = rows. len ( ) ;
594598
595- let widths = [ Constraint :: Length ( 25 ) , Constraint :: Length ( 20 ) ] ;
599+ let widths = [
600+ Constraint :: Length ( 20 ) ,
601+ Constraint :: Length ( max_name_width. try_into ( ) . unwrap ( ) ) ,
602+ ] ;
596603
597604 let new_devices_table = Table :: new ( rows, widths)
598605 . header ( {
You can’t perform that action at this time.
0 commit comments