Skip to content

Commit

Permalink
fix: Make the help text copyable
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Jul 16, 2021
1 parent 1fa9dc0 commit 769e292
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,25 +218,27 @@ impl App {
*/
pub fn show_help_message(&mut self, kernel_modules: &mut KernelModules<'_>) {
let key_bindings: Vec<(&str, &str)> = util::KEY_BINDINGS.to_vec();

let mut help_text = Vec::new();
let mut help_text_raw = Vec::new();
for (key, desc) in &key_bindings {
help_text.push(Spans::from(Span::styled(
format!("{}:", key),
format!("{}:", &key),
self.style.colored,
)));
help_text_raw.push(format!("{}:", key));
help_text.push(Spans::from(Span::styled(
format!("{}{}", self.style.unicode.get(Symbol::Blank), desc),
format!("{}{}", self.style.unicode.get(Symbol::Blank), &desc),
self.style.default,
)));
help_text_raw.push(format!(" {}", &desc));
}
kernel_modules.info_scroll_offset = 0;
kernel_modules.command = ModuleCommand::None;
kernel_modules.current_name =
format!("!Help{}", self.style.unicode.get(Symbol::Helmet));
kernel_modules
.current_info
.set(Text::from(help_text), kernel_modules.current_name.clone());
.set(Text::from(help_text), help_text_raw.join("\n"));
}

/**
Expand Down

0 comments on commit 769e292

Please sign in to comment.