Skip to content

Commit e0334f7

Browse files
committed
Avoid nested function definition
1 parent c658a99 commit e0334f7

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

src/list/state.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,6 @@ impl<'a> ListState<'a> {
233233
)?;
234234
next_ln(stdout)?;
235235

236-
fn hotkey(writer: &mut MaxLenWriter, hotkey: &[u8]) -> io::Result<()> {
237-
writer
238-
.stdout
239-
.queue(SetForegroundColor(Color::Yellow))?
240-
.queue(SetAttribute(Attribute::Bold))?;
241-
writer.write_ascii(hotkey)?;
242-
writer.stdout.queue(ResetColor)?;
243-
Ok(())
244-
}
245-
246236
let mut writer = MaxLenWriter::new(stdout, self.term_width as usize);
247237
if self.message.is_empty() {
248238
// Help footer message
@@ -446,3 +436,14 @@ impl<'a> ListState<'a> {
446436
Ok(true)
447437
}
448438
}
439+
440+
/// Draw an emphasized hotkey in the list footer.
441+
fn hotkey(writer: &mut MaxLenWriter, hotkey: &[u8]) -> io::Result<()> {
442+
writer
443+
.stdout
444+
.queue(SetForegroundColor(Color::Yellow))?
445+
.queue(SetAttribute(Attribute::Bold))?;
446+
writer.write_ascii(hotkey)?;
447+
writer.stdout.queue(ResetColor)?;
448+
Ok(())
449+
}

0 commit comments

Comments
 (0)