Fix some overzealous format!() removals and a stray comment

This commit is contained in:
Brooks J Rady 2021-03-26 13:02:31 +00:00
parent 6316763b0e
commit c71252f77e
2 changed files with 17 additions and 6 deletions

View file

@ -27,7 +27,6 @@ serde_yaml = "0.8"
signal-hook = "0.1.10" signal-hook = "0.1.10"
strip-ansi-escapes = "0.1.0" strip-ansi-escapes = "0.1.0"
structopt = "0.3" structopt = "0.3"
# termion = { git = "https://gitlab.com/TheLostLambda/termion.git", version = "1.6.0", features = ["serde"] }
termion = "1.5.0" termion = "1.5.0"
termios = "0.3" termios = "0.3"
unicode-truncate = "0.2.0" unicode-truncate = "0.2.0"

View file

@ -83,7 +83,11 @@ fn unselected_mode_shortcut(letter: char, text: &str) -> LinePart {
.on(BRIGHT_GRAY) .on(BRIGHT_GRAY)
.bold() .bold()
.paint(">"); .paint(">");
let styled_text = Style::new().fg(BLACK).on(BRIGHT_GRAY).bold().paint(text); let styled_text = Style::new()
.fg(BLACK)
.on(BRIGHT_GRAY)
.bold()
.paint(format!("{} ", text));
let suffix_separator = Style::new().fg(BRIGHT_GRAY).on(GRAY).paint(ARROW_SEPARATOR); let suffix_separator = Style::new().fg(BRIGHT_GRAY).on(GRAY).paint(ARROW_SEPARATOR);
LinePart { LinePart {
part: ANSIStrings(&[ part: ANSIStrings(&[
@ -109,7 +113,11 @@ fn selected_mode_shortcut(letter: char, text: &str) -> LinePart {
.bold() .bold()
.paint(letter.to_string()); .paint(letter.to_string());
let char_right_separator = Style::new().bold().fg(BLACK).on(GREEN).bold().paint(">"); let char_right_separator = Style::new().bold().fg(BLACK).on(GREEN).bold().paint(">");
let styled_text = Style::new().fg(BLACK).on(GREEN).bold().paint(text); let styled_text = Style::new()
.fg(BLACK)
.on(GREEN)
.bold()
.paint(format!("{} ", text));
let suffix_separator = Style::new().fg(GREEN).on(GRAY).paint(ARROW_SEPARATOR); let suffix_separator = Style::new().fg(GREEN).on(GRAY).paint(ARROW_SEPARATOR);
LinePart { LinePart {
part: ANSIStrings(&[ part: ANSIStrings(&[
@ -127,7 +135,11 @@ fn selected_mode_shortcut(letter: char, text: &str) -> LinePart {
fn disabled_mode_shortcut(text: &str) -> LinePart { fn disabled_mode_shortcut(text: &str) -> LinePart {
let prefix_separator = Style::new().fg(GRAY).on(BRIGHT_GRAY).paint(ARROW_SEPARATOR); let prefix_separator = Style::new().fg(GRAY).on(BRIGHT_GRAY).paint(ARROW_SEPARATOR);
let styled_text = Style::new().fg(GRAY).on(BRIGHT_GRAY).dimmed().paint(text); let styled_text = Style::new()
.fg(GRAY)
.on(BRIGHT_GRAY)
.dimmed()
.paint(format!("{} ", text));
let suffix_separator = Style::new().fg(BRIGHT_GRAY).on(GRAY).paint(ARROW_SEPARATOR); let suffix_separator = Style::new().fg(BRIGHT_GRAY).on(GRAY).paint(ARROW_SEPARATOR);
LinePart { LinePart {
part: format!("{}{}{}", prefix_separator, styled_text, suffix_separator), part: format!("{}{}{}", prefix_separator, styled_text, suffix_separator),
@ -136,7 +148,7 @@ fn disabled_mode_shortcut(text: &str) -> LinePart {
} }
fn selected_mode_shortcut_single_letter(letter: char) -> LinePart { fn selected_mode_shortcut_single_letter(letter: char) -> LinePart {
let char_shortcut_text = letter.to_string(); let char_shortcut_text = format!(" {} ", letter);
let len = char_shortcut_text.chars().count() + 4; // 2 for the arrows, 2 for the padding let len = char_shortcut_text.chars().count() + 4; // 2 for the arrows, 2 for the padding
let prefix_separator = Style::new().fg(GRAY).on(GREEN).paint(ARROW_SEPARATOR); let prefix_separator = Style::new().fg(GRAY).on(GREEN).paint(ARROW_SEPARATOR);
let char_shortcut = Style::new() let char_shortcut = Style::new()
@ -153,7 +165,7 @@ fn selected_mode_shortcut_single_letter(letter: char) -> LinePart {
} }
fn unselected_mode_shortcut_single_letter(letter: char) -> LinePart { fn unselected_mode_shortcut_single_letter(letter: char) -> LinePart {
let char_shortcut_text = letter.to_string(); let char_shortcut_text = format!(" {} ", letter);
let len = char_shortcut_text.chars().count() + 4; // 2 for the arrows, 2 for the padding let len = char_shortcut_text.chars().count() + 4; // 2 for the arrows, 2 for the padding
let prefix_separator = Style::new().fg(GRAY).on(BRIGHT_GRAY).paint(ARROW_SEPARATOR); let prefix_separator = Style::new().fg(GRAY).on(BRIGHT_GRAY).paint(ARROW_SEPARATOR);
let char_shortcut = Style::new() let char_shortcut = Style::new()