fix(status-line): remove black background from shortcuts (#276)

* fix(status-line): remove black background from shortcuts

* style(fmt): rustfmt
This commit is contained in:
Aram Drevekenin 2021-04-18 09:58:00 +02:00 committed by GitHub
parent d5be5e3a84
commit 8a8d536c84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,18 +2,18 @@
use ansi_term::{ANSIStrings, Style};
use zellij_tile::prelude::*;
use crate::colors::{BLACK, GREEN, ORANGE, WHITE};
use crate::colors::{GREEN, ORANGE, WHITE};
use crate::{LinePart, MORE_MSG};
fn full_length_shortcut(is_first_shortcut: bool, letter: &str, description: &str) -> LinePart {
let separator = if is_first_shortcut { " " } else { " / " };
let separator = Style::new().on(BLACK).fg(WHITE).paint(separator);
let separator = Style::new().fg(WHITE).paint(separator);
let shortcut_len = letter.chars().count() + 3; // 2 for <>'s around shortcut, 1 for the space
let shortcut_left_separator = Style::new().on(BLACK).fg(WHITE).paint("<");
let shortcut = Style::new().on(BLACK).fg(GREEN).bold().paint(letter);
let shortcut_right_separator = Style::new().on(BLACK).fg(WHITE).paint("> ");
let shortcut_left_separator = Style::new().fg(WHITE).paint("<");
let shortcut = Style::new().fg(GREEN).bold().paint(letter);
let shortcut_right_separator = Style::new().fg(WHITE).paint("> ");
let description_len = description.chars().count();
let description = Style::new().on(BLACK).fg(WHITE).bold().paint(description);
let description = Style::new().fg(WHITE).bold().paint(description);
let len = shortcut_len + description_len + separator.chars().count();
LinePart {
part: format!(
@ -32,18 +32,14 @@ fn full_length_shortcut(is_first_shortcut: bool, letter: &str, description: &str
fn first_word_shortcut(is_first_shortcut: bool, letter: &str, description: &str) -> LinePart {
let separator = if is_first_shortcut { " " } else { " / " };
let separator = Style::new().on(BLACK).fg(WHITE).paint(separator);
let separator = Style::new().fg(WHITE).paint(separator);
let shortcut_len = letter.chars().count() + 3; // 2 for <>'s around shortcut, 1 for the space
let shortcut_left_separator = Style::new().on(BLACK).fg(WHITE).paint("<");
let shortcut = Style::new().on(BLACK).fg(GREEN).bold().paint(letter);
let shortcut_right_separator = Style::new().on(BLACK).fg(WHITE).paint("> ");
let shortcut_left_separator = Style::new().fg(WHITE).paint("<");
let shortcut = Style::new().fg(GREEN).bold().paint(letter);
let shortcut_right_separator = Style::new().fg(WHITE).paint("> ");
let description_first_word = description.split(' ').next().unwrap_or("");
let description_first_word_length = description_first_word.chars().count();
let description_first_word = Style::new()
.on(BLACK)
.fg(WHITE)
.bold()
.paint(description_first_word);
let description_first_word = Style::new().fg(WHITE).bold().paint(description_first_word);
let len = shortcut_len + description_first_word_length + separator.chars().count();
LinePart {
part: format!(
@ -179,7 +175,7 @@ fn quicknav_short() -> LinePart {
fn locked_interface_indication() -> LinePart {
let locked_text = " -- INTERFACE LOCKED -- ";
let locked_text_len = locked_text.chars().count();
let locked_styled_text = Style::new().on(BLACK).fg(WHITE).bold().paint(locked_text);
let locked_styled_text = Style::new().fg(WHITE).bold().paint(locked_text);
LinePart {
part: format!("{}", locked_styled_text),
len: locked_text_len,
@ -190,13 +186,13 @@ fn select_pane_shortcut(is_first_shortcut: bool) -> LinePart {
let shortcut = "ENTER";
let description = "Select pane";
let separator = if is_first_shortcut { " " } else { " / " };
let separator = Style::new().on(BLACK).fg(WHITE).paint(separator);
let separator = Style::new().fg(WHITE).paint(separator);
let shortcut_len = shortcut.chars().count() + 3; // 2 for <>'s around shortcut, 1 for the space
let shortcut_left_separator = Style::new().on(BLACK).fg(WHITE).paint("<");
let shortcut = Style::new().on(BLACK).fg(ORANGE).bold().paint(shortcut);
let shortcut_right_separator = Style::new().on(BLACK).fg(WHITE).paint("> ");
let shortcut_left_separator = Style::new().fg(WHITE).paint("<");
let shortcut = Style::new().fg(ORANGE).bold().paint(shortcut);
let shortcut_right_separator = Style::new().fg(WHITE).paint("> ");
let description_len = description.chars().count();
let description = Style::new().on(BLACK).fg(WHITE).bold().paint(description);
let description = Style::new().fg(WHITE).bold().paint(description);
let len = shortcut_len + description_len + separator.chars().count();
LinePart {
part: format!(