summaryrefslogtreecommitdiffstats
path: root/default-plugins/status-bar/src/tip/data/move_tabs.rs
blob: 6ad119e49cf9aa0dfbb5e346cc398501d08b3394 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
use ansi_term::{
    unstyled_len, ANSIString, ANSIStrings,
    Color::{Fixed, RGB},
    Style,
};

use zellij_tile::prelude::*;
use zellij_tile_utils::palette_match;

use crate::LinePart;

macro_rules! strings {
    ($ANSIStrings:expr) => {{
        let strings: &[ANSIString] = $ANSIStrings;

        let ansi_strings = ANSIStrings(strings);

        LinePart {
            part: format!("{}", ansi_strings),
            len: unstyled_len(&ansi_strings),
        }
    }};
}

pub fn move_tabs_full(help: &ModeInfo) -> LinePart {
    // Tip: Wrong order of tabs? You can move them to left and right with:
    // Alt + i (left) and Alt + o (right)
    let green_color = palette_match!(help.style.colors.green);

    let bits = vec![
        Style::new().paint(" Tip: "),
        Style::new().paint("Wrong order of tabs? You can move them to left and right with: "),
        Style::new().fg(green_color).bold().paint("Alt + i"),
        Style::new().paint(" (left) and "),
        Style::new().fg(green_color).bold().paint("Alt + o"),
        Style::new().paint(" (right)"),
    ];
    strings!(&bits)
}

pub fn move_tabs_medium(help: &ModeInfo) -> LinePart {
    // Tip: You can move tabs to left and right with:
    // Alt + i (left) and Alt + o (right)
    let green_color = palette_match!(help.style.colors.green);

    let bits = vec![
        Style::new().paint(" Tip: "),
        Style::new().paint("You can move tabs to left and right with: "),
        Style::new().fg(green_color).bold().paint("Alt + i"),
        Style::new().paint(" (left) and "),
        Style::new().fg(green_color).bold().paint("Alt + o"),
        Style::new().paint(" (right)"),
    ];
    strings!(&bits)
}

pub fn move_tabs_short(help: &ModeInfo) -> LinePart {
    // Move tabs with: Alt + i (left) and Alt + o (right)
    let green_color = palette_match!(help.style.colors.green);

    let bits = vec![
        Style::new().paint(" Move tabs with: "),
        Style::new().fg(green_color).bold().paint("Alt + i"),
        Style::new().paint(" (left) and "),
        Style::new().fg(green_color).bold().paint("Alt + o"),
        Style::new().paint(" (right)"),
    ];
    strings!(&bits)
}