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/edit_scrollbuffer.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/edit_scrollbuffer.rs')
| -rw-r--r-- | default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs b/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs new file mode 100644 index 00000000..3807f55d --- /dev/null +++ b/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs @@ -0,0 +1,78 @@ +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 edit_scrollbuffer_full(palette: Palette) -> LinePart { + // Tip: Search through the scrollbuffer using your default $EDITOR with + // Ctrl + <s> + <e> + let green_color = palette_match!(palette.green); + let orange_color = palette_match!(palette.orange); + + strings!(&[ + Style::new().paint(" Tip: "), + Style::new().paint("Search through the scrollbuffer using your default "), + Style::new().fg(green_color).bold().paint("$EDITOR"), + Style::new().paint(" with "), + Style::new().fg(orange_color).bold().paint("Ctrl"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<s>"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<e>"), + ]) +} + +pub fn edit_scrollbuffer_medium(palette: Palette) -> LinePart { + // Tip: Search the scrollbuffer using your $EDITOR with + // Ctrl + <s> + <e> + let green_color = palette_match!(palette.green); + let orange_color = palette_match!(palette.orange); + + strings!(&[ + Style::new().paint(" Tip: "), + Style::new().paint("Search the scrollbuffer using your "), + Style::new().fg(green_color).bold().paint("$EDITOR"), + Style::new().paint(" with "), + Style::new().fg(orange_color).bold().paint("Ctrl"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<s>"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<e>"), + ]) +} + +pub fn edit_scrollbuffer_short(palette: Palette) -> LinePart { + // Search using $EDITOR with + // Ctrl + <s> + <e> + let green_color = palette_match!(palette.green); + let orange_color = palette_match!(palette.orange); + + strings!(&[ + Style::new().paint(" Search using "), + Style::new().fg(green_color).bold().paint("$EDITOR"), + Style::new().paint(" with "), + Style::new().fg(orange_color).bold().paint("Ctrl"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<s>"), + Style::new().paint(" + "), + Style::new().fg(green_color).bold().paint("<e>"), + ]) +} |
