aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrooks J Rady <b.j.rady@gmail.com>2021-03-26 13:02:31 +0000
committerBrooks J Rady <b.j.rady@gmail.com>2021-03-26 13:02:31 +0000
commitc71252f77eed82140765a370fabb206a9960c092 (patch)
treee8ab04124ee7f5c87cd88be63c1867c7d9b2289c
parentFixing a load of clippy lints in status-bar (diff)
downloadsl0ppij-c71252f77eed82140765a370fabb206a9960c092.tar.gz
sl0ppij-c71252f77eed82140765a370fabb206a9960c092.tar.xz
sl0ppij-c71252f77eed82140765a370fabb206a9960c092.zip
Fix some overzealous format!() removals and a stray comment
-rw-r--r--Cargo.toml1
-rw-r--r--default-tiles/status-bar/src/first_line.rs22
2 files changed, 17 insertions, 6 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d83100ff..776eb3e9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,7 +27,6 @@ serde_yaml = "0.8"
signal-hook = "0.1.10"
strip-ansi-escapes = "0.1.0"
structopt = "0.3"
-# termion = { git = "https://gitlab.com/TheLostLambda/termion.git", version = "1.6.0", features = ["serde"] }
termion = "1.5.0"
termios = "0.3"
unicode-truncate = "0.2.0"
diff --git a/default-tiles/status-bar/src/first_line.rs b/default-tiles/status-bar/src/first_line.rs
index 41fe5729..0e4ec53b 100644
--- a/default-tiles/status-bar/src/first_line.rs
+++ b/default-tiles/status-bar/src/first_line.rs
@@ -83,7 +83,11 @@ fn unselected_mode_shortcut(letter: char, text: &str) -> LinePart {
.on(BRIGHT_GRAY)
.bold()
.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);
LinePart {
part: ANSIStrings(&[
@@ -109,7 +113,11 @@ fn selected_mode_shortcut(letter: char, text: &str) -> LinePart {
.bold()
.paint(letter.to_string());
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);
LinePart {
part: ANSIStrings(&[
@@ -127,7 +135,11 @@ fn selected_mode_shortcut(letter: char, text: &str) -> LinePart {
fn disabled_mode_shortcut(text: &str) -> LinePart {
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);
LinePart {
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 {
- 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 prefix_separator = Style::new().fg(GRAY).on(GREEN).paint(ARROW_SEPARATOR);
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 {
- 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 prefix_separator = Style::new().fg(GRAY).on(BRIGHT_GRAY).paint(ARROW_SEPARATOR);
let char_shortcut = Style::new()