aboutsummaryrefslogtreecommitdiffstats
path: root/default-plugins/status-bar
diff options
context:
space:
mode:
authorBartosz Zbytniewski <50180524+devzbysiu@users.noreply.github.com>2024-02-18 19:40:03 +0100
committerGitHub <noreply@github.com>2024-02-19 03:40:03 +0900
commitdd5ea26cc72f3c39e9f8b4d8452a42c9c2f85442 (patch)
treee37c0d0b75d7edb7538c44ba10ba752d8ff68497 /default-plugins/status-bar
parentdocs(changelog): break pane fix (diff)
downloadsl0ppij-dd5ea26cc72f3c39e9f8b4d8452a42c9c2f85442.tar.gz
sl0ppij-dd5ea26cc72f3c39e9f8b4d8452a42c9c2f85442.tar.xz
sl0ppij-dd5ea26cc72f3c39e9f8b4d8452a42c9c2f85442.zip
feat: add moving tab to other position (#3047)
* feat: add moving tab to other position * docs(changelog): revert changes * test: update config snapshots * refactor: get rid of HorizontalDirection enum * refactor: cleanup code order * refactor: use debug! instead of info! * refactor: use more defensive way to switch tabs * refactor: revert tip changes * refactor: code formatting * refactor: improve invalid input notification * refactor: inline fns for calculating target index --------- Co-authored-by: Jae-Heon Ji <atx6419@gmail.com>
Diffstat (limited to 'default-plugins/status-bar')
-rw-r--r--default-plugins/status-bar/src/tip/data/mod.rs9
-rw-r--r--default-plugins/status-bar/src/tip/data/move_tabs.rs69
2 files changed, 78 insertions, 0 deletions
diff --git a/default-plugins/status-bar/src/tip/data/mod.rs b/default-plugins/status-bar/src/tip/data/mod.rs
index 1354b1ab..731fa777 100644
--- a/default-plugins/status-bar/src/tip/data/mod.rs
+++ b/default-plugins/status-bar/src/tip/data/mod.rs
@@ -8,6 +8,7 @@ mod compact_layout;
mod edit_scrollbuffer;
mod floating_panes_mouse;
mod move_focus_hjkl_tab_switch;
+mod move_tabs;
mod quicknav;
mod send_mouse_click_to_terminal;
mod sync_tab;
@@ -88,5 +89,13 @@ lazy_static! {
full: compact_layout::compact_layout_full,
}
),
+ (
+ "move_tabs",
+ TipBody {
+ short: move_tabs::move_tabs_short,
+ medium: move_tabs::move_tabs_medium,
+ full: move_tabs::move_tabs_full,
+ }
+ )
]);
}
diff --git a/default-plugins/status-bar/src/tip/data/move_tabs.rs b/default-plugins/status-bar/src/tip/data/move_tabs.rs
new file mode 100644
index 00000000..6ad119e4
--- /dev/null
+++ b/default-plugins/status-bar/src/tip/data/move_tabs.rs
@@ -0,0 +1,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)
+}