diff options
| author | Aram Drevekenin <aram@poor.dev> | 2022-06-07 14:28:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-07 14:28:39 +0200 |
| commit | 3be718371af9029822e2aeb3f52b5dde1b7397d1 (patch) | |
| tree | 017147ebe5418a67570b9e7ea3d9ba3bf990cd83 /default-plugins/status-bar/src/tip/data/sync_tab.rs | |
| parent | docs(changelog): tweak simplified ui (diff) | |
| download | sl0ppij-3be718371af9029822e2aeb3f52b5dde1b7397d1.tar.gz sl0ppij-3be718371af9029822e2aeb3f52b5dde1b7397d1.tar.xz sl0ppij-3be718371af9029822e2aeb3f52b5dde1b7397d1.zip | |
feat(ui): add status bar tips (#1462)
* feat(ui): add more tips to status bar
* fix(e2e): clear status-bar-tips cache for each test
* style(fmt): rustfmt
Diffstat (limited to 'default-plugins/status-bar/src/tip/data/sync_tab.rs')
| -rw-r--r-- | default-plugins/status-bar/src/tip/data/sync_tab.rs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/default-plugins/status-bar/src/tip/data/sync_tab.rs b/default-plugins/status-bar/src/tip/data/sync_tab.rs new file mode 100644 index 00000000..27d0ae7f --- /dev/null +++ b/default-plugins/status-bar/src/tip/data/sync_tab.rs @@ -0,0 +1,69 @@ +use ansi_term::{ + unstyled_len, ANSIString, ANSIStrings, + Color::{Fixed, RGB}, + Style, +}; + +use crate::LinePart; +use zellij_tile::prelude::*; +use zellij_tile_utils::palette_match; + +macro_rules! strings { + ($ANSIStrings:expr) => {{ + let strings: &[ANSIString<'static>] = $ANSIStrings; + + let ansi_strings = ANSIStrings(strings); + + LinePart { + part: format!("{}", ansi_strings), + len: unstyled_len(&ansi_strings), + } + }}; +} + +pub fn sync_tab_full(palette: Palette) -> LinePart { + // Tip: Sync a tab and write keyboard input to all panes with Ctrl + <t> + <s> + let green_color = palette_match!(palette.green); + let orange_color = palette_match!(palette.orange); + + strings!(&[ + Style::new().paint(" Tip: "), + Style::new().paint("Sync a tab and write keyboard input to all its panes with "), + Style::new().fg(orange_color).bold().paint("Ctrl"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<t>"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<s>"), + ]) +} + +pub fn sync_tab_medium(palette: Palette) -> LinePart { + // Tip: Sync input to panes in a tab with Ctrl + <t> + <s> + let green_color = palette_match!(palette.green); + let orange_color = palette_match!(palette.orange); + + strings!(&[ + Style::new().paint(" Tip: "), + Style::new().paint("Sync input to panes in a tab with "), + Style::new().fg(orange_color).bold().paint("Ctrl"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<t>"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<s>"), + ]) +} + +pub fn sync_tab_short(palette: Palette) -> LinePart { + // Sync input in a tab with Ctrl + <t> + <s> + let green_color = palette_match!(palette.green); + let orange_color = palette_match!(palette.orange); + + strings!(&[ + Style::new().paint(" Sync input in a tab with "), + Style::new().fg(orange_color).bold().paint("Ctrl"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<t>"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<s>"), + ]) +} |
