@@ -4,6 +4,7 @@ use ratatui::buffer::Buffer;
4
4
use ratatui:: layout:: Rect ;
5
5
use ratatui:: style:: Color ;
6
6
use ratatui:: style:: Style ;
7
+ use ratatui:: style:: Stylize ;
7
8
use ratatui:: widgets:: Block ;
8
9
use ratatui:: widgets:: BorderType ;
9
10
use ratatui:: widgets:: Borders ;
@@ -147,8 +148,6 @@ impl CommandPopup {
147
148
148
149
impl WidgetRef for CommandPopup {
149
150
fn render_ref ( & self , area : Rect , buf : & mut Buffer ) {
150
- let style = Style :: default ( ) . bg ( Color :: Blue ) . fg ( Color :: White ) ;
151
-
152
151
let matches = self . filtered_commands ( ) ;
153
152
154
153
let mut rows: Vec < Row > = Vec :: new ( ) ;
@@ -157,21 +156,25 @@ impl WidgetRef for CommandPopup {
157
156
158
157
if visible_matches. is_empty ( ) {
159
158
rows. push ( Row :: new ( vec ! [
160
- Cell :: from( "" ) . style ( style ) ,
161
- Cell :: from( "No matching commands" ) . style ( style . add_modifier( Modifier :: ITALIC ) ) ,
159
+ Cell :: from( "" ) ,
160
+ Cell :: from( "No matching commands" ) . add_modifier( Modifier :: ITALIC ) ,
162
161
] ) ) ;
163
162
} else {
163
+ let default_style = Style :: default ( ) ;
164
+ let command_style = Style :: default ( ) . fg ( Color :: LightBlue ) ;
164
165
for ( idx, cmd) in visible_matches. iter ( ) . enumerate ( ) {
165
- let highlight = Style :: default ( ) . bg ( Color :: White ) . fg ( Color :: Blue ) ;
166
- let cmd_style = if Some ( idx) == self . selected_idx {
167
- highlight
166
+ let ( cmd_style, desc_style) = if Some ( idx) == self . selected_idx {
167
+ (
168
+ command_style. bg ( Color :: DarkGray ) ,
169
+ default_style. bg ( Color :: DarkGray ) ,
170
+ )
168
171
} else {
169
- style
172
+ ( command_style , default_style )
170
173
} ;
171
174
172
175
rows. push ( Row :: new ( vec ! [
173
- Cell :: from( cmd. command( ) . to_string ( ) ) . style( cmd_style) ,
174
- Cell :: from( cmd. description( ) . to_string( ) ) . style( style ) ,
176
+ Cell :: from( format! ( "/{}" , cmd. command( ) ) ) . style( cmd_style) ,
177
+ Cell :: from( cmd. description( ) . to_string( ) ) . style( desc_style ) ,
175
178
] ) ) ;
176
179
}
177
180
}
@@ -182,13 +185,11 @@ impl WidgetRef for CommandPopup {
182
185
rows,
183
186
[ Constraint :: Length ( FIRST_COLUMN_WIDTH ) , Constraint :: Min ( 10 ) ] ,
184
187
)
185
- . style ( style)
186
- . column_spacing ( 1 )
188
+ . column_spacing ( 0 )
187
189
. block (
188
190
Block :: default ( )
189
191
. borders ( Borders :: ALL )
190
- . border_type ( BorderType :: Rounded )
191
- . style ( style) ,
192
+ . border_type ( BorderType :: Rounded ) ,
192
193
) ;
193
194
194
195
table. render ( area, buf) ;
0 commit comments