11use std:: collections:: HashMap ;
22
33use ratatui:: {
4- layout:: { Alignment , Constraint , Rect } ,
4+ layout:: { Constraint , Rect } ,
55 style:: { Color , Modifier , Style } ,
66 text:: { Line , Span , Text } ,
77 widgets:: {
@@ -79,7 +79,7 @@ impl<'km> KeybindingsPopup<'km> {
7979 Constraint :: Length ( desired_width. min ( screen_width * 60 / 100 ) )
8080 } else if screen_width > 80 {
8181 let percentage = 60 + ( ( 120 - screen_width) * 20 / 40 ) ;
82- Constraint :: Percentage ( percentage. into ( ) )
82+ Constraint :: Percentage ( percentage)
8383 } else {
8484 Constraint :: Percentage ( 90 )
8585 }
@@ -90,7 +90,7 @@ impl<'km> KeybindingsPopup<'km> {
9090 Constraint :: Percentage ( 60 )
9191 } else if screen_height > 24 {
9292 let percentage = 70 + ( ( 40 - screen_height) * 15 / 16 ) ;
93- Constraint :: Percentage ( percentage. into ( ) )
93+ Constraint :: Percentage ( percentage)
9494 } else {
9595 Constraint :: Percentage ( 90 )
9696 }
@@ -127,8 +127,6 @@ impl<'a> StatefulWidget for KeybindingsPopup<'a> {
127127 }
128128
129129 let block = Block :: default ( )
130- . title ( " Keybindings " )
131- . title_alignment ( Alignment :: Center )
132130 . borders ( Borders :: ALL )
133131 . border_type ( BorderType :: Rounded ) ;
134132
@@ -145,10 +143,10 @@ impl<'a> StatefulWidget for KeybindingsPopup<'a> {
145143
146144 let area = util:: center ( area, width_constraint, height_constraint) ;
147145
148- let area = util:: center ( area, width_constraint, height_constraint) ;
149-
150146 Clear . render ( area, buf) ;
151147
148+ let inner_area = block. inner ( area) ;
149+
152150 StatefulWidget :: render (
153151 Table :: new ( rows, constraints)
154152 . block ( block)
@@ -157,7 +155,9 @@ impl<'a> StatefulWidget for KeybindingsPopup<'a> {
157155 . style ( Style :: default ( ) . add_modifier ( Modifier :: BOLD ) )
158156 . bottom_margin ( 1 ) ,
159157 )
160- . row_highlight_style ( Style :: default ( ) . add_modifier ( Modifier :: REVERSED ) ) ,
158+ . row_highlight_style (
159+ Style :: default ( ) . add_modifier ( Modifier :: BOLD | Modifier :: UNDERLINED ) ,
160+ ) ,
161161 area,
162162 buf,
163163 state,
@@ -172,6 +172,6 @@ impl<'a> StatefulWidget for KeybindingsPopup<'a> {
172172 . position ( state. selected ( ) . unwrap_or ( 0 ) )
173173 . viewport_content_length ( viewport_height) ;
174174
175- scrollbar. render ( area , buf, & mut scrollbar_state) ;
175+ scrollbar. render ( inner_area , buf, & mut scrollbar_state) ;
176176 }
177177}
0 commit comments