@@ -233,43 +233,77 @@ impl<'a> ListState<'a> {
233233 ) ?;
234234 next_ln ( stdout) ?;
235235
236+ let hotkey = |writer : & mut MaxLenWriter , hotkey| -> io:: Result < ( ) > {
237+ writer
238+ . stdout
239+ . queue ( SetForegroundColor ( Color :: Yellow ) ) ?
240+ . queue ( SetAttribute ( Attribute :: Bold ) ) ?;
241+ writer. write_ascii ( hotkey) ?;
242+ writer
243+ . stdout
244+ . queue ( SetForegroundColor ( Color :: Reset ) ) ?
245+ . queue ( SetAttribute ( Attribute :: NoBold ) ) ?;
246+ Ok ( ( ) )
247+ } ;
248+
236249 let mut writer = MaxLenWriter :: new ( stdout, self . term_width as usize ) ;
237250 if self . message . is_empty ( ) {
238251 // Help footer message
239252 if self . scroll_state . selected ( ) . is_some ( ) {
240- writer. write_str ( "↓/j ↑/k home/g end/G | <c>ontinue at | <r>eset exercise" ) ?;
253+ writer. write_str ( "↓/" ) ?;
254+ hotkey ( & mut writer, b"j" ) ?;
255+ writer. write_str ( " ↑/" ) ?;
256+ hotkey ( & mut writer, b"k" ) ?;
257+ writer. write_ascii ( b" home/" ) ?;
258+ hotkey ( & mut writer, b"g" ) ?;
259+ writer. write_ascii ( b" end/" ) ?;
260+ hotkey ( & mut writer, b"G" ) ?;
261+ writer. write_ascii ( b" | " ) ?;
262+ hotkey ( & mut writer, b"c" ) ?;
263+ writer. write_ascii ( b"ontinue at | " ) ?;
264+ hotkey ( & mut writer, b"r" ) ?;
265+ writer. write_ascii ( b"eset exercise" ) ?;
241266 next_ln ( stdout) ?;
242267 writer = MaxLenWriter :: new ( stdout, self . term_width as usize ) ;
243268
244- writer. write_ascii ( b"<s>earch | filter " ) ?;
269+ hotkey ( & mut writer, b"s" ) ?;
270+ writer. write_ascii ( b"earch | filter " ) ?;
245271 } else {
246272 // Nothing selected (and nothing shown), so only display filter and quit.
247273 writer. write_ascii ( b"filter " ) ?;
248274 }
249275
250276 match self . filter {
251277 Filter :: Done => {
252- writer
253- . stdout
254- . queue ( SetForegroundColor ( Color :: Magenta ) ) ?
255- . queue ( SetAttribute ( Attribute :: Underlined ) ) ?;
256- writer. write_ascii ( b"<d>one" ) ?;
278+ writer. stdout . queue ( SetAttribute ( Attribute :: Underlined ) ) ?;
279+ hotkey ( & mut writer, b"d" ) ?;
280+ writer. stdout . queue ( SetForegroundColor ( Color :: Magenta ) ) ?;
281+ writer. write_str ( "one" ) ?;
257282 writer. stdout . queue ( ResetColor ) ?;
258- writer. write_ascii ( b"/<p>ending" ) ?;
283+ writer. write_ascii ( b"/" ) ?;
284+ hotkey ( & mut writer, b"p" ) ?;
285+ writer. write_ascii ( b"ending" ) ?;
259286 }
260287 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" ) ?;
288+ hotkey ( & mut writer , b"d ") ?;
289+ writer. write_ascii ( b"one/" ) ? ;
290+ writer . stdout . queue ( SetAttribute ( Attribute :: Underlined ) ) ? ;
291+ hotkey ( & mut writer , b"p" ) ? ;
292+ writer . stdout . queue ( SetForegroundColor ( Color :: Magenta ) ) ?;
293+ writer. write_ascii ( b"ending" ) ?;
267294 writer. stdout . queue ( ResetColor ) ?;
268295 }
269- Filter :: None => writer. write_ascii ( b"<d>one/<p>ending" ) ?,
296+ Filter :: None => {
297+ hotkey ( & mut writer, b"d" ) ?;
298+ writer. write_ascii ( b"one/" ) ?;
299+ hotkey ( & mut writer, b"p" ) ?;
300+ writer. write_ascii ( b"ending" ) ?;
301+ }
270302 }
271303
272- writer. write_ascii ( b" | <q>uit list" ) ?;
304+ writer. write_ascii ( b" | " ) ?;
305+ hotkey ( & mut writer, b"q" ) ?;
306+ writer. write_ascii ( b"uit list" ) ?;
273307 } else {
274308 writer. stdout . queue ( SetForegroundColor ( Color :: Magenta ) ) ?;
275309 writer. write_str ( & self . message ) ?;
0 commit comments