diff options
| author | a-kenji <aks.kenji@protonmail.com> | 2021-05-09 16:44:05 +0200 |
|---|---|---|
| committer | a-kenji <aks.kenji@protonmail.com> | 2021-05-10 16:03:06 +0200 |
| commit | 088bcf3dd8aab4e522cface84c0a260b5b37a87c (patch) | |
| tree | 5ed94988521c3caa2eefc00277569345e0f0d8f6 /default-plugins/tab-bar/src/tab.rs | |
| parent | README: shortening + add explanation (#470) (diff) | |
| download | sl0ppij-088bcf3dd8aab4e522cface84c0a260b5b37a87c.tar.gz sl0ppij-088bcf3dd8aab4e522cface84c0a260b5b37a87c.tar.xz sl0ppij-088bcf3dd8aab4e522cface84c0a260b5b37a87c.zip | |
Add Option for Simplified Layout
* the simplified layout omits the Nerdfonts characters that are not
found in every Fontset
* add an optional config option to opt into the simplified ui
`simplified_ui: bool`
* add a config flag that allows opting into the simplified ui
`zellij options --simplified-ui`
* move the `clean` flag to the `setup` subcommand
Diffstat (limited to 'default-plugins/tab-bar/src/tab.rs')
| -rw-r--r-- | default-plugins/tab-bar/src/tab.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/default-plugins/tab-bar/src/tab.rs b/default-plugins/tab-bar/src/tab.rs index 7c1fe6b3..85e2c378 100644 --- a/default-plugins/tab-bar/src/tab.rs +++ b/default-plugins/tab-bar/src/tab.rs @@ -1,15 +1,15 @@ -use crate::{LinePart, ARROW_SEPARATOR}; +use crate::{line::tab_separator, LinePart}; use ansi_term::ANSIStrings; use zellij_tile::prelude::*; use zellij_tile_utils::style; -pub fn active_tab(text: String, palette: Palette) -> LinePart { - let left_separator = style!(palette.bg, palette.green).paint(ARROW_SEPARATOR); +pub fn active_tab(text: String, palette: Palette, separator: &str) -> LinePart { + let left_separator = style!(palette.bg, palette.green).paint(separator); let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the text padding let tab_styled_text = style!(palette.black, palette.green) .bold() .paint(format!(" {} ", text)); - let right_separator = style!(palette.green, palette.bg).paint(ARROW_SEPARATOR); + let right_separator = style!(palette.green, palette.bg).paint(separator); let tab_styled_text = format!( "{}", ANSIStrings(&[left_separator, tab_styled_text, right_separator,]) @@ -20,13 +20,13 @@ pub fn active_tab(text: String, palette: Palette) -> LinePart { } } -pub fn non_active_tab(text: String, palette: Palette) -> LinePart { - let left_separator = style!(palette.bg, palette.fg).paint(ARROW_SEPARATOR); +pub fn non_active_tab(text: String, palette: Palette, separator: &str) -> LinePart { + let left_separator = style!(palette.bg, palette.fg).paint(separator); let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the padding let tab_styled_text = style!(palette.black, palette.fg) .bold() .paint(format!(" {} ", text)); - let right_separator = style!(palette.fg, palette.bg).paint(ARROW_SEPARATOR); + let right_separator = style!(palette.fg, palette.bg).paint(separator); let tab_styled_text = format!( "{}", ANSIStrings(&[left_separator, tab_styled_text, right_separator,]) @@ -43,7 +43,9 @@ pub fn tab_style( position: usize, is_sync_panes_active: bool, palette: Palette, + capabilities: PluginCapabilities, ) -> LinePart { + let separator = tab_separator(capabilities); let mut tab_text = if text.is_empty() { format!("Tab #{}", position + 1) } else { @@ -53,8 +55,8 @@ pub fn tab_style( tab_text.push_str(" (Sync)"); } if is_active_tab { - active_tab(tab_text, palette) + active_tab(tab_text, palette, separator) } else { - non_active_tab(tab_text, palette) + non_active_tab(tab_text, palette, separator) } } |
