@@ -233,43 +233,72 @@ impl<'a> ListState<'a> {
233233 ) ?;
234234 next_ln ( stdout) ?;
235235
236+ let hotkey_color = Color :: Yellow ;
237+ let hotkey = |writer : & mut MaxLenWriter , hotkey| -> io:: Result < ( ) > {
238+ writer. stdout . queue ( SetForegroundColor ( hotkey_color) ) ?;
239+ writer. write_ascii ( hotkey) ?;
240+ writer. stdout . queue ( SetForegroundColor ( Color :: Reset ) ) ?;
241+ Ok ( ( ) )
242+ } ;
243+
236244 let mut writer = MaxLenWriter :: new ( stdout, self . term_width as usize ) ;
237245 if self . message . is_empty ( ) {
238246 // Help footer message
239247 if self . scroll_state . selected ( ) . is_some ( ) {
240- writer. write_str ( "↓/j ↑/k home/g end/G | <c>ontinue at | <r>eset exercise" ) ?;
248+ writer. write_str ( "↓/" ) ?;
249+ hotkey ( & mut writer, b"j" ) ?;
250+ writer. write_str ( " ↑/" ) ?;
251+ hotkey ( & mut writer, b"k" ) ?;
252+ writer. write_ascii ( b" home/" ) ?;
253+ hotkey ( & mut writer, b"g" ) ?;
254+ writer. write_ascii ( b" end/" ) ?;
255+ hotkey ( & mut writer, b"G" ) ?;
256+ writer. write_ascii ( b" | " ) ?;
257+ hotkey ( & mut writer, b"c" ) ?;
258+ writer. write_ascii ( b"ontinue at | " ) ?;
259+ hotkey ( & mut writer, b"r" ) ?;
260+ writer. write_ascii ( b"eset exercise" ) ?;
241261 next_ln ( stdout) ?;
242262 writer = MaxLenWriter :: new ( stdout, self . term_width as usize ) ;
243263
244- writer. write_ascii ( b"<s>earch | filter " ) ?;
264+ hotkey ( & mut writer, b"s" ) ?;
265+ writer. write_ascii ( b"earch | filter " ) ?;
245266 } else {
246267 // Nothing selected (and nothing shown), so only display filter and quit.
247268 writer. write_ascii ( b"filter " ) ?;
248269 }
249270
250271 match self . filter {
251272 Filter :: Done => {
252- writer
253- . stdout
254- . queue ( SetForegroundColor ( Color :: Magenta ) ) ?
255- . queue ( SetAttribute ( Attribute :: Underlined ) ) ?;
256- writer. write_ascii ( b"<d>one" ) ?;
273+ writer. stdout . queue ( SetAttribute ( Attribute :: Underlined ) ) ?;
274+ hotkey ( & mut writer, b"d" ) ?;
275+ writer. stdout . queue ( SetForegroundColor ( Color :: Magenta ) ) ?;
276+ writer. write_str ( "one" ) ?;
257277 writer. stdout . queue ( ResetColor ) ?;
258- writer. write_ascii ( b"/<p>ending" ) ?;
278+ writer. write_ascii ( b"/" ) ?;
279+ hotkey ( & mut writer, b"p" ) ?;
280+ writer. write_ascii ( b"ending" ) ?;
259281 }
260282 Filter :: Pending => {
261- writer . write_ascii ( b"<d>one/ ") ?;
262- writer
263- . stdout
264- . queue ( SetForegroundColor ( Color :: Magenta ) ) ?
265- . queue ( SetAttribute ( Attribute :: Underlined ) ) ?;
266- writer. write_ascii ( b"<p> ending" ) ?;
283+ hotkey ( & mut writer , b"d ") ?;
284+ writer. write_ascii ( b"one/" ) ? ;
285+ writer . stdout . queue ( SetAttribute ( Attribute :: Underlined ) ) ? ;
286+ hotkey ( & mut writer , b"p" ) ? ;
287+ writer . stdout . queue ( SetForegroundColor ( Color :: Magenta ) ) ?;
288+ writer. write_ascii ( b"ending" ) ?;
267289 writer. stdout . queue ( ResetColor ) ?;
268290 }
269- Filter :: None => writer. write_ascii ( b"<d>one/<p>ending" ) ?,
291+ Filter :: None => {
292+ hotkey ( & mut writer, b"d" ) ?;
293+ writer. write_ascii ( b"one/" ) ?;
294+ hotkey ( & mut writer, b"p" ) ?;
295+ writer. write_ascii ( b"ending" ) ?;
296+ }
270297 }
271298
272- writer. write_ascii ( b" | <q>uit list" ) ?;
299+ writer. write_ascii ( b" | " ) ?;
300+ hotkey ( & mut writer, b"q" ) ?;
301+ writer. write_ascii ( b"uit list" ) ?;
273302 } else {
274303 writer. stdout . queue ( SetForegroundColor ( Color :: Magenta ) ) ?;
275304 writer. write_str ( & self . message ) ?;
0 commit comments