@@ -44,7 +44,6 @@ pub struct ListState<'a> {
44
44
term_width : u16 ,
45
45
term_height : u16 ,
46
46
separator_line : Vec < u8 > ,
47
- narrow_term : bool ,
48
47
show_footer : bool ,
49
48
}
50
49
@@ -78,7 +77,6 @@ impl<'a> ListState<'a> {
78
77
term_width : 0 ,
79
78
term_height : 0 ,
80
79
separator_line : Vec :: new ( ) ,
81
- narrow_term : false ,
82
80
show_footer : true ,
83
81
} ;
84
82
@@ -96,13 +94,9 @@ impl<'a> ListState<'a> {
96
94
return ;
97
95
}
98
96
99
- let wide_help_footer_width = 95 ;
100
- // The help footer is shorter when nothing is selected.
101
- self . narrow_term = width < wide_help_footer_width && self . scroll_state . selected ( ) . is_some ( ) ;
102
-
103
97
let header_height = 1 ;
104
- // 2 separator , 1 progress bar, 1- 2 footer message.
105
- let footer_height = 4 + u16 :: from ( self . narrow_term ) ;
98
+ // 2 separators , 1 progress bar, 2 footer message lines .
99
+ let footer_height = 5 ;
106
100
self . show_footer = height > header_height + footer_height;
107
101
108
102
if self . show_footer {
@@ -227,14 +221,10 @@ impl<'a> ListState<'a> {
227
221
// Help footer message
228
222
if self . scroll_state . selected ( ) . is_some ( ) {
229
223
writer. write_str ( "↓/j ↑/k home/g end/G | <c>ontinue at | <r>eset exercise" ) ?;
230
- if self . narrow_term {
231
- next_ln ( stdout) ?;
232
- writer = MaxLenWriter :: new ( stdout, self . term_width as usize ) ;
224
+ next_ln ( stdout) ?;
225
+ writer = MaxLenWriter :: new ( stdout, self . term_width as usize ) ;
233
226
234
- writer. write_ascii ( b"filter " ) ?;
235
- } else {
236
- writer. write_ascii ( b" | filter " ) ?;
237
- }
227
+ writer. write_ascii ( b"<s>earch | filter " ) ?;
238
228
} else {
239
229
// Nothing selected (and nothing shown), so only display filter and quit.
240
230
writer. write_ascii ( b"filter " ) ?;
@@ -263,17 +253,14 @@ impl<'a> ListState<'a> {
263
253
}
264
254
265
255
writer. write_ascii ( b" | <q>uit list" ) ?;
266
- next_ln ( stdout) ?;
267
256
} else {
268
257
writer. stdout . queue ( SetForegroundColor ( Color :: Magenta ) ) ?;
269
258
writer. write_str ( & self . message ) ?;
270
259
stdout. queue ( ResetColor ) ?;
271
260
next_ln ( stdout) ?;
272
-
273
- if self . narrow_term {
274
- next_ln ( stdout) ?;
275
- }
276
261
}
262
+
263
+ next_ln ( stdout) ?;
277
264
}
278
265
279
266
stdout. queue ( EndSynchronizedUpdate ) ?. flush ( )
0 commit comments