diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-07-06 22:09:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-06 22:09:06 +0200 |
| commit | 5b310ada794559c8be459424db03e83548151700 (patch) | |
| tree | 31b32a998598f253a4171dcb72f82550199745e1 | |
| parent | fix: more verbose startup errors (#5334) (diff) | |
| download | sl0ppij-5b310ada794559c8be459424db03e83548151700.tar.gz sl0ppij-5b310ada794559c8be459424db03e83548151700.tar.xz sl0ppij-5b310ada794559c8be459424db03e83548151700.zip | |
UI tweaks (#5337)
* remove dimmed
* clearer list ui
* fix integration tests
* rustfmt
* move hint to tab-bar
* redesign stack list
* rustfmt
* fix e2e
* add pr
45 files changed, 253 insertions, 196 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f8de28c..ca0cdb0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * feat: new title-frames UI (https://github.com/zellij-org/zellij/pull/5318) * chore: upgrade wasmi to 1.1.0 (https://github.com/zellij-org/zellij/pull/5319) * fix: fragmented STDIN causing "garbage" input on slow SSH connections (https://github.com/zellij-org/zellij/pull/5320) -* feat: stacked lists - new stack UI (https://github.com/zellij-org/zellij/pull/5331) +* feat: stacked lists - new stack UI (https://github.com/zellij-org/zellij/pull/5331 and https://github.com/zellij-org/zellij/pull/5337) * fix: more verbose startup errors (https://github.com/zellij-org/zellij/pull/5334) ## [0.44.3] - 2026-05-13 diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index 6cffc5c7..673d7c8c 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -42,8 +42,6 @@ struct State { classic_ui: bool, base_mode_is_locked: bool, cached_keybinds: KeybindsVec, - hint_text: Option<BTreeMap<usize, StyledText>>, - outstanding_hint_timeouts: usize, new_pane_ribbon_range: Option<(usize, usize)>, floating_ribbon_range: Option<(usize, usize)>, new_pane_ribbon_hovered: bool, @@ -222,8 +220,6 @@ impl ZellijPlugin for State { EventType::InputReceived, EventType::SystemClipboardFailure, EventType::InitialKeybinds, - EventType::HintText, - EventType::Timer, EventType::Mouse, ]); } @@ -276,33 +272,11 @@ impl ZellijPlugin for State { Event::InputReceived => { if self.text_copy_destination.is_some() || self.display_system_clipboard_failure == true - || self.hint_text.is_some() { should_render = true; } self.text_copy_destination = None; self.display_system_clipboard_failure = false; - self.hint_text = None; - }, - Event::HintText(hint_variants) => { - if hint_variants.is_empty() { - if self.hint_text.is_some() { - self.hint_text = None; - should_render = true; - } - } else { - self.hint_text = Some(hint_variants); - self.outstanding_hint_timeouts += 1; - set_timeout(5.0); - should_render = true; - } - }, - Event::Timer(_) => { - self.outstanding_hint_timeouts = self.outstanding_hint_timeouts.saturating_sub(1); - if self.outstanding_hint_timeouts == 0 && self.hint_text.is_some() { - self.hint_text = None; - should_render = true; - } }, Event::Mouse(mouse_event) => match mouse_event { Mouse::LeftClick(_, col) => { @@ -347,12 +321,6 @@ impl ZellijPlugin for State { PaletteColor::EightBit(color) => format!("\u{1b}[48;5;{}m\u{1b}[0K", color), }; let active_tab = self.tabs.iter().find(|t| t.active); - let full_pane_frames = self.mode_info.pane_frame_style == Some(PaneFrameStyle::Full); - let hint_text = if full_pane_frames { - None - } else { - self.hint_text.as_ref() - }; let (line, new_pane_ribbon_range, floating_ribbon_range) = one_line_ui( &self.mode_info, active_tab, @@ -361,7 +329,6 @@ impl ZellijPlugin for State { self.base_mode_is_locked, self.text_copy_destination, self.display_system_clipboard_failure, - hint_text, self.new_pane_ribbon_hovered, self.floating_ribbon_hovered, ); diff --git a/default-plugins/status-bar/src/one_line_ui.rs b/default-plugins/status-bar/src/one_line_ui.rs index 97721167..6d00a6bf 100644 --- a/default-plugins/status-bar/src/one_line_ui.rs +++ b/default-plugins/status-bar/src/one_line_ui.rs @@ -3,7 +3,7 @@ use ansi_term::{ Color::{Fixed, RGB}, Style, }; -use std::collections::{BTreeMap, HashMap}; +use std::collections::HashMap; use zellij_tile::prelude::actions::Action; use zellij_tile::prelude::*; use zellij_tile_utils::{palette_match, style}; @@ -22,7 +22,6 @@ pub fn one_line_ui( base_mode_is_locked: bool, text_copied_to_clipboard_destination: Option<CopyDestination>, clipboard_failure: bool, - hint: Option<&BTreeMap<usize, StyledText>>, new_pane_hovered: bool, floating_hovered: bool, ) -> (LinePart, Option<(usize, usize)>, Option<(usize, usize)>) { @@ -40,9 +39,7 @@ pub fn one_line_ui( let mut new_pane_range = None; let mut floating_range = None; - let left_part = hint - .and_then(|hint| hint_line_part(hint, max_len)) - .or_else(|| render_mode_key_indicators(help, max_len, separator, base_mode_is_locked)); + let left_part = render_mode_key_indicators(help, max_len, separator, base_mode_is_locked); if let Some(left) = left_part { line_part_to_render.append(&left); max_len = max_len.saturating_sub(left.len); @@ -77,16 +74,6 @@ pub fn one_line_ui( (line_part_to_render, new_pane_range, floating_range) } -fn hint_line_part(hint: &BTreeMap<usize, StyledText>, max_len: usize) -> Option<LinePart> { - let fitting_variant = hint - .range(..=max_len) - .next_back() - .map(|(_width, styled_text)| styled_text)?; - let len = fitting_variant.text.width(); - let part = serialize_text(&Text::from(fitting_variant.clone())); - Some(LinePart { part, len }) -} - fn to_base_mode(base_mode: InputMode) -> Action { Action::SwitchToMode { input_mode: base_mode, diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs index 99b85f05..84c5b3aa 100644 --- a/default-plugins/tab-bar/src/line.rs +++ b/default-plugins/tab-bar/src/line.rs @@ -1,4 +1,5 @@ use ansi_term::ANSIStrings; +use std::collections::BTreeMap; use unicode_width::UnicodeWidthStr; use crate::{LinePart, ARROW_SEPARATOR}; @@ -225,6 +226,7 @@ pub fn tab_line( hide_swap_layout_indicator: bool, background: &PaletteColor, active_pane_scroll: Option<(usize, usize)>, + hint: Option<&BTreeMap<usize, StyledText>>, is_alternate_tab: bool, new_tab_button_is_hovered: bool, ) -> (Vec<LinePart>, Option<(usize, usize)>) { @@ -258,6 +260,10 @@ pub fn tab_line( // Drop indicator if it would cause wrapping (active tab always rendered unconditionally) let prefix_len = get_current_title_len(&prefix); + let hint_budget = cols.saturating_sub(prefix_len + active_tab.len); + if let Some(hint_part) = hint.and_then(|hint| hint_line_part(hint, hint_budget)) { + swap_layout_indicator = Some(hint_part); + } let indicator_len = swap_layout_indicator.as_ref().map(|s| s.len).unwrap_or(0); if indicator_len > 0 && prefix_len + active_tab.len + indicator_len > cols { swap_layout_indicator = None; @@ -362,6 +368,20 @@ fn swap_layout_status( } } +fn hint_line_part(hint: &BTreeMap<usize, StyledText>, max_len: usize) -> Option<LinePart> { + let fitting_variant = hint + .range(..=max_len) + .next_back() + .map(|(_width, styled_text)| styled_text)?; + let len = fitting_variant.text.width(); + let part = serialize_text(&Text::from(fitting_variant.clone())); + Some(LinePart { + part, + len, + tab_index: None, + }) +} + fn scroll_status(scroll: (usize, usize), palette: Styling) -> LinePart { let (position, length) = scroll; let text = format!("[ SCROLL {}/{} ]", position, length); diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs index 6fa92c75..4b521969 100644 --- a/default-plugins/tab-bar/src/main.rs +++ b/default-plugins/tab-bar/src/main.rs @@ -37,6 +37,8 @@ struct State { new_tab_button_range: Option<(usize, usize)>, hovered_tab_idx: Option<usize>, hovered_new_tab_button: bool, + hint_text: Option<BTreeMap<usize, StyledText>>, + outstanding_hint_timeouts: usize, } static ARROW_SEPARATOR: &str = ""; @@ -56,6 +58,9 @@ impl ZellijPlugin for State { EventType::Mouse, EventType::InitialKeybinds, EventType::ActivePaneScroll, + EventType::HintText, + EventType::Timer, + EventType::InputReceived, ]); } @@ -100,6 +105,32 @@ impl ZellijPlugin for State { } self.active_pane_scroll = scroll; }, + Event::HintText(hint_variants) => { + if hint_variants.is_empty() { + if self.hint_text.is_some() { + self.hint_text = None; + should_render = true; + } + } else { + self.hint_text = Some(hint_variants); + self.outstanding_hint_timeouts += 1; + set_timeout(5.0); + should_render = true; + } + }, + Event::Timer(_) => { + self.outstanding_hint_timeouts = self.outstanding_hint_timeouts.saturating_sub(1); + if self.outstanding_hint_timeouts == 0 && self.hint_text.is_some() { + self.hint_text = None; + should_render = true; + } + }, + Event::InputReceived => { + if self.hint_text.is_some() { + self.hint_text = None; + should_render = true; + } + }, Event::Mouse(me) => match me { Mouse::LeftClick(_, col) => { if let Some((start, end)) = self.new_tab_button_range { @@ -188,6 +219,12 @@ impl ZellijPlugin for State { let background = self.mode_info.style.colors.text_unselected.background; + let full_pane_frames = self.mode_info.pane_frame_style == Some(PaneFrameStyle::Full); + let hint_text = if full_pane_frames { + None + } else { + self.hint_text.as_ref() + }; let (line, new_tab_button_range) = tab_line( self.mode_info.session_name.as_deref(), all_tabs, @@ -201,6 +238,7 @@ impl ZellijPlugin for State { self.hide_swap_layout_indication, &background, self.active_pane_scroll, + hint_text, is_alternate_tab, self.hovered_new_tab_button, ); diff --git a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__quit_and_resurrect_session.snap b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__quit_and_resurrect_session.snap index cee30f74..b860357b 100644 --- a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__quit_and_resurrect_session.snap +++ b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__quit_and_resurrect_session.snap @@ -2,7 +2,7 @@ source: src/tests/e2e/cases.rs expression: last_snapshot --- - Zellij (e2e-test) Tab #1 Tab #2 Tab #3 Tab #4 + + Zellij (e2e-test) Tab #1 Tab #2 Tab #3 Tab #4 + <ENTER> run, <ESC> drop to shell, <Ctrl-c> exit Pane #1 │ Pane #2 $ │$ │ diff --git a/zellij-integration-tests/tests/panes.rs b/zellij-integration-tests/tests/panes.rs index 4f207aeb..5ed88a1d 100644 --- a/zellij-integration-tests/tests/panes.rs +++ b/zellij-integration-tests/tests/panes.rs @@ -454,7 +454,7 @@ fn new_stacked_pane() { zellij.send_stdin(&keys::ctrl('p')); zellij.send_stdin(&keys::key('s')); - let grid_snapshot = spawn_second_pane_and_wait_for_grid(&zellij, col(2).row(3)); + let grid_snapshot = spawn_second_pane_and_wait_for_grid(&zellij, col(2).row(4)); assert_snapshot!(normalized(&grid_snapshot)); zellij.quit(); } @@ -630,7 +630,7 @@ fn toggle_frames_with_stacked_panes() { zellij.send_stdin(&keys::ctrl('p')); zellij.send_stdin(&keys::key('s')); - spawn_second_pane_and_wait_for_grid(&zellij, col(2).row(3)); + spawn_second_pane_and_wait_for_grid(&zellij, col(2).row(4)); zellij.wait_until("stacked panes show their titles", |grid_snapshot| { grid_snapshot.contains("Pane #1") diff --git a/zellij-integration-tests/tests/snapshots/misc__previous_swap_layout.snap b/zellij-integration-tests/tests/snapshots/misc__previous_swap_layout.snap index 2da49ae8..edf1efb7 100644 --- a/zellij-integration-tests/tests/snapshots/misc__previous_swap_layout.snap +++ b/zellij-integration-tests/tests/snapshots/misc__previous_swap_layout.snap @@ -1,10 +1,9 @@ --- source: zellij-integration-tests/tests/misc.rs -assertion_line: 135 expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - <↓↑> [ Pane #2 ] + Pane #1 + > Pane #2 $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/panes__new_stacked_pane.snap b/zellij-integration-tests/tests/snapshots/panes__new_stacked_pane.snap index 981eacb8..6dce9ccd 100644 --- a/zellij-integration-tests/tests/snapshots/panes__new_stacked_pane.snap +++ b/zellij-integration-tests/tests/snapshots/panes__new_stacked_pane.snap @@ -3,7 +3,7 @@ source: zellij-integration-tests/tests/panes.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - <↓↑> [ Pane #2 ] + Pane #1 + > Pane #2 $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/panes__toggle_frames_with_stacked_panes.snap b/zellij-integration-tests/tests/snapshots/panes__toggle_frames_with_stacked_panes.snap index bb7c6619..a955d0d9 100644 --- a/zellij-integration-tests/tests/snapshots/panes__toggle_frames_with_stacked_panes.snap +++ b/zellij-integration-tests/tests/snapshots/panes__toggle_frames_with_stacked_panes.snap @@ -3,8 +3,8 @@ source: zellij-integration-tests/tests/panes.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - <↓↑> [ Pane #2 ] + Pane #1 + > Pane #2 ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │$ █ │ │ │ @@ -23,6 +23,5 @@ expression: normalized(&grid_snapshot) │ │ │ │ │ │ -│ │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_hidden_held_members_exit_code_shows_on_its_entry.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_hidden_held_members_exit_code_shows_on_its_entry.snap index 2883add3..ba84ee58 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_hidden_held_members_exit_code_shows_on_its_entry.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_hidden_held_members_exit_code_shows_on_its_entry.snap @@ -3,7 +3,7 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - <↓↑> [ Pane #1 ] - member-command [ EXIT CODE: 2 ] + > Pane #1 + member-command [ EXIT CODE: 2 ] █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_hidden_member_exiting_removes_its_entry.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_hidden_member_exiting_removes_its_entry.snap index f22cebdb..a968820b 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_hidden_member_exiting_removes_its_entry.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_hidden_member_exiting_removes_its_entry.snap @@ -3,8 +3,8 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - <↓↑> [ Pane #3 ] + Pane #1 + > Pane #3 $ third-member $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_layout_stack_renders_as_a_title_list.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_layout_stack_renders_as_a_title_list.snap index c7b1664a..cda205c2 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_layout_stack_renders_as_a_title_list.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_layout_stack_renders_as_a_title_list.snap @@ -3,8 +3,8 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - <↓↑> [ Pane #1 ] - Pane #2 - Pane #3 + > Pane #1 + Pane #2 + Pane #3 $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_stack_list_survives_session_resurrection.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_stack_list_survives_session_resurrection.snap index 5fd161c8..ccf9842d 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_stack_list_survives_session_resurrection.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__a_stack_list_survives_session_resurrection.snap @@ -3,8 +3,8 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - Pane #2 - <↓↑> [ Pane #3 ] + Pane #1 + Pane #2 + > Pane #3 $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__breaking_the_visible_member_out_promotes_and_moves_it_to_a_new_tab.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__breaking_the_visible_member_out_promotes_and_moves_it_to_a_new_tab.snap index 4d3c879f..35a49566 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__breaking_the_visible_member_out_promotes_and_moves_it_to_a_new_tab.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__breaking_the_visible_member_out_promotes_and_moves_it_to_a_new_tab.snap @@ -3,8 +3,8 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 Tab #2 + - Pane #1 - <↓↑> [ Pane #2 ] + Pane #1 + > Pane #2 $ second-member $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__clicking_a_hidden_entry_swaps_it_in.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__clicking_a_hidden_entry_swaps_it_in.snap index 0b9e625e..571ada79 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__clicking_a_hidden_entry_swaps_it_in.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__clicking_a_hidden_entry_swaps_it_in.snap @@ -3,9 +3,9 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&swapped_in) --- Zellij (test) Tab #1 + - <↓↑> [ Pane #1 ] - Pane #2 - Pane #3 + > Pane #1 + Pane #2 + Pane #3 $ first-member $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__closing_the_visible_member_promotes_its_neighbor.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__closing_the_visible_member_promotes_its_neighbor.snap index 2bf7907f..ecb49594 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__closing_the_visible_member_promotes_its_neighbor.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__closing_the_visible_member_promotes_its_neighbor.snap @@ -3,8 +3,8 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - <↓↑> [ Pane #2 ] + Pane #1 + > Pane #2 $ second-member $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__entries_share_a_uniform_width_sized_by_the_widest_title.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__entries_share_a_uniform_width_sized_by_the_widest_title.snap index ce7b2325..81785c95 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__entries_share_a_uniform_width_sized_by_the_widest_title.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__entries_share_a_uniform_width_sized_by_the_widest_title.snap @@ -3,7 +3,7 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - <↓↑> [ Pane #1 ] - member-command + > Pane #1 + member-command $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__floating_the_visible_member_promotes_its_neighbor.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__floating_the_visible_member_promotes_its_neighbor.snap index ac32526e..f912750c 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__floating_the_visible_member_promotes_its_neighbor.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__floating_the_visible_member_promotes_its_neighbor.snap @@ -3,8 +3,8 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - <↓↑> [ Pane #2 ] + Pane #1 + > Pane #2 $ second-member $ ┌ Pane #3 ──────────────────────────────────────── PIN [ ] ┐ diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__fullscreen_suspends_the_list_and_restores_it.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__fullscreen_suspends_the_list_and_restores_it.snap index feda85cd..e04f4c85 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__fullscreen_suspends_the_list_and_restores_it.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__fullscreen_suspends_the_list_and_restores_it.snap @@ -3,9 +3,9 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - Pane #2 - <↓↑> [ Pane #3 ] + Pane #1 + Pane #2 + > Pane #3 $ third-member $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__moving_the_visible_member_reorders_the_list.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__moving_the_visible_member_reorders_the_list.snap index 84fa4772..4992e1f6 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__moving_the_visible_member_reorders_the_list.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__moving_the_visible_member_reorders_the_list.snap @@ -7,8 +7,8 @@ expression: normalized(&grid_snapshot) $ first-member $ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── - <↓↑> [ Pane #3 ] - Pane #2 + > Pane #3 + Pane #2 $ third-member $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__resizing_the_visible_member_keeps_the_list.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__resizing_the_visible_member_keeps_the_list.snap index 646bf29a..e6411622 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__resizing_the_visible_member_keeps_the_list.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__resizing_the_visible_member_keeps_the_list.snap @@ -7,7 +7,7 @@ expression: normalized(&grid_snapshot) $ first-member $ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── - Pane #2 - <↓↑> [ Pane #3 ] + Pane #2 + > Pane #3 $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__splitting_a_new_pane_reforms_the_list_around_it.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__splitting_a_new_pane_reforms_the_list_around_it.snap index c280cedf..cde05d3f 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__splitting_a_new_pane_reforms_the_list_around_it.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__splitting_a_new_pane_reforms_the_list_around_it.snap @@ -3,9 +3,9 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - Pane #2 - <↓↑> [ Pane #3 ] + Pane #1 + Pane #2 + > Pane #3 $ third-member $ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__stack_renders_as_title_list_above_the_visible_pane.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__stack_renders_as_title_list_above_the_visible_pane.snap index feda85cd..e04f4c85 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__stack_renders_as_title_list_above_the_visible_pane.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__stack_renders_as_title_list_above_the_visible_pane.snap @@ -3,9 +3,9 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - Pane #2 - <↓↑> [ Pane #3 ] + Pane #1 + Pane #2 + > Pane #3 $ third-member $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__the_visible_members_scroll_state_shows_on_its_entry.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__the_visible_members_scroll_state_shows_on_its_entry.snap index 8de841a2..155453b0 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__the_visible_members_scroll_state_shows_on_its_entry.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__the_visible_members_scroll_state_shows_on_its_entry.snap @@ -3,9 +3,8 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&grid_snapshot) --- Zellij (test) Tab #1 + - Pane #1 - <↓↑> [ Pane #2 ] [ SCROLL: 21/21 ] -$ line0 + Pane #1 + > Pane #2 [ SCROLL: 21/22 ] line1 line2 line3 diff --git a/zellij-integration-tests/tests/snapshots/stacked_pane_list__up_and_down_move_the_selection_through_the_list.snap b/zellij-integration-tests/tests/snapshots/stacked_pane_list__up_and_down_move_the_selection_through_the_list.snap index 62d35692..dad03f9a 100644 --- a/zellij-integration-tests/tests/snapshots/stacked_pane_list__up_and_down_move_the_selection_through_the_list.snap +++ b/zellij-integration-tests/tests/snapshots/stacked_pane_list__up_and_down_move_the_selection_through_the_list.snap @@ -3,9 +3,9 @@ source: zellij-integration-tests/tests/stacked_pane_list.rs expression: normalized(&middle_member_selected) --- Zellij (test) Tab #1 + - Pane #1 - <↓↑> [ Pane #2 ] - Pane #3 + Pane #1 + > Pane #2 + Pane #3 $ second-member $ █ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SEARCH <o> SESSION <q> QUIT ... diff --git a/zellij-integration-tests/tests/stacked_pane_list.rs b/zellij-integration-tests/tests/stacked_pane_list.rs index 59a92377..e3404f8c 100644 --- a/zellij-integration-tests/tests/stacked_pane_list.rs +++ b/zellij-integration-tests/tests/stacked_pane_list.rs @@ -49,6 +49,10 @@ layout { } "#; +fn selected_entry(title: &str) -> String { + format!("> {}", title) +} + fn add_stacked_pane_and_wait_for_selected_entry( zellij: &TestSession, selected_entry_title: &str, @@ -57,9 +61,9 @@ fn add_stacked_pane_and_wait_for_selected_entry( zellij.send_stdin(&keys::key('s')); let terminal = zellij.expect_pty_spawn(); terminal.output(PROMPT); - let bracketed_entry = format!("[ {} ]", selected_entry_title); + let selected_marker = selected_entry(selected_entry_title); zellij.wait_until("stacked pane added and selected", |grid_snapshot| { - grid_snapshot.status_bar_appears() && grid_snapshot.contains(&bracketed_entry) + grid_snapshot.status_bar_appears() && grid_snapshot.contains(&selected_marker) }); terminal } @@ -124,7 +128,7 @@ fn stack_renders_as_title_list_above_the_visible_pane() { grid_snapshot.status_bar_appears() && grid_snapshot.contains("Pane #1") && grid_snapshot.contains("Pane #2") - && grid_snapshot.contains("[ Pane #3 ]") + && grid_snapshot.contains(&selected_entry("Pane #3")) && grid_snapshot.contains("third-member") }); assert_snapshot!(normalized(&grid_snapshot)); @@ -143,7 +147,7 @@ fn a_layout_stack_renders_as_a_title_list() { let grid_snapshot = zellij.wait_until("layout stack rendered as a list", |grid_snapshot| { grid_snapshot.status_bar_appears() - && grid_snapshot.contains("[ Pane #1 ]") + && grid_snapshot.contains(&selected_entry("Pane #1")) && grid_snapshot.contains("Pane #2") && grid_snapshot.contains("Pane #3") }); @@ -168,7 +172,7 @@ fn disabling_stacked_pane_list_restores_the_classic_stack() { grid_snapshot.status_bar_appears() && grid_snapshot.contains("Pane #1") && grid_snapshot.contains("Pane #2") - && !grid_snapshot.contains("[ Pane #2 ]") + && !grid_snapshot.contains(&selected_entry("Pane #2")) && grid_snapshot.cursor_is_at(col(2).row(3)) }); assert_snapshot!(normalized(&grid_snapshot)); @@ -183,20 +187,21 @@ fn up_and_down_move_the_selection_through_the_list() { zellij.send_stdin(&keys::alt('k')); let middle_member_selected = zellij.wait_until("middle member swapped in", |grid_snapshot| { grid_snapshot.contains("<g> LOCK") - && grid_snapshot.contains("[ Pane #2 ]") + && grid_snapshot.contains(&selected_entry("Pane #2")) && grid_snapshot.contains("second-member") - && !grid_snapshot.contains("[ Pane #3 ]") + && !grid_snapshot.contains(&selected_entry("Pane #3")) }); assert_snapshot!(normalized(&middle_member_selected)); zellij.send_stdin(&keys::alt('k')); zellij.wait_until("top member swapped in", |grid_snapshot| { - grid_snapshot.contains("[ Pane #1 ]") && grid_snapshot.contains("first-member") + grid_snapshot.contains(&selected_entry("Pane #1")) && grid_snapshot.contains("first-member") }); zellij.send_stdin(&keys::alt('j')); zellij.wait_until("selection moved back down", |grid_snapshot| { - grid_snapshot.contains("[ Pane #2 ]") && grid_snapshot.contains("second-member") + grid_snapshot.contains(&selected_entry("Pane #2")) + && grid_snapshot.contains("second-member") }); zellij.quit(); } @@ -211,21 +216,23 @@ fn navigating_past_the_top_entry_leaves_the_stack() { zellij.send_stdin(&keys::alt('k')); zellij.wait_until("selection on the middle entry", |grid_snapshot| { - grid_snapshot.contains("[ Pane #3 ]") + grid_snapshot.contains(&selected_entry("Pane #3")) }); zellij.send_stdin(&keys::alt('k')); zellij.wait_until("selection on the top entry", |grid_snapshot| { - grid_snapshot.contains("[ Pane #2 ]") + grid_snapshot.contains(&selected_entry("Pane #2")) }); zellij.send_stdin(&keys::alt('k')); zellij.wait_until("focus left the stack to the pane above", |grid_snapshot| { - grid_snapshot.contains("[ Pane #2 ]") && grid_snapshot.cursor_is_at(col(2).row(2)) + grid_snapshot.contains(&selected_entry("Pane #2")) + && grid_snapshot.cursor_is_at(col(2).row(2)) }); zellij.send_stdin(&keys::alt('j')); zellij.wait_until("focus re-entered the stack", |grid_snapshot| { - grid_snapshot.contains("[ Pane #2 ]") && grid_snapshot.cursor_is_at(col(2).row(15)) + grid_snapshot.contains(&selected_entry("Pane #2")) + && grid_snapshot.cursor_is_at(col(2).row(16)) }); zellij.quit(); } @@ -242,7 +249,7 @@ fn closing_the_visible_member_promotes_its_neighbor() { zellij.wait_until("third member closed, second promoted", |grid_snapshot| { grid_snapshot.status_bar_appears() && !grid_snapshot.contains("Pane #3") - && grid_snapshot.contains("[ Pane #2 ]") + && grid_snapshot.contains(&selected_entry("Pane #2")) && grid_snapshot.contains("second-member") }); assert_snapshot!(normalized(&grid_snapshot)); @@ -280,7 +287,7 @@ fn a_hidden_member_exiting_removes_its_entry() { grid_snapshot.status_bar_appears() && !grid_snapshot.contains("Pane #2") && grid_snapshot.contains("Pane #1") - && grid_snapshot.contains("[ Pane #3 ]") + && grid_snapshot.contains(&selected_entry("Pane #3")) }); assert_snapshot!(normalized(&grid_snapshot)); zellij.quit(); @@ -304,7 +311,7 @@ fn breaking_the_visible_member_out_promotes_and_moves_it_to_a_new_tab() { let grid_snapshot = zellij.wait_until("stack shrank to two members", |grid_snapshot| { grid_snapshot.status_bar_appears() && grid_snapshot.contains("Pane #1") - && grid_snapshot.contains("[ Pane #2 ]") + && grid_snapshot.contains(&selected_entry("Pane #2")) && !grid_snapshot.contains("Pane #3") && grid_snapshot.contains("second-member") }); @@ -322,7 +329,7 @@ fn floating_the_visible_member_promotes_its_neighbor() { let grid_snapshot = zellij.wait_until("member floated over the stack", |grid_snapshot| { grid_snapshot.status_bar_appears() - && grid_snapshot.contains("[ Pane #2 ]") + && grid_snapshot.contains(&selected_entry("Pane #2")) && grid_snapshot.contains("Pane #3") && grid_snapshot.contains("third-member") }); @@ -338,7 +345,8 @@ fn fullscreen_suspends_the_list_and_restores_it() { zellij.send_stdin(&keys::ctrl('p')); zellij.send_stdin(&keys::key('f')); zellij.wait_until("stack member fullscreened", |grid_snapshot| { - grid_snapshot.contains("(FULLSCREEN)") && !grid_snapshot.contains("[ Pane #3 ]") + grid_snapshot.contains("(FULLSCREEN)") + && !grid_snapshot.contains(&selected_entry("Pane #3")) }); zellij.send_stdin(&keys::ctrl('p')); @@ -348,7 +356,7 @@ fn fullscreen_suspends_the_list_and_restores_it() { && !grid_snapshot.contains("(FULLSCREEN)") && grid_snapshot.contains("Pane #1") && grid_snapshot.contains("Pane #2") - && grid_snapshot.contains("[ Pane #3 ]") + && grid_snapshot.contains(&selected_entry("Pane #3")) && grid_snapshot.contains("third-member") }); assert_snapshot!(normalized(&grid_snapshot)); @@ -363,14 +371,14 @@ fn clicking_a_hidden_entry_swaps_it_in() { build_three_member_stack(&zellij); let grid_snapshot = zellij.wait_until("stack list rendered", |grid_snapshot| { - grid_snapshot.contains("Pane #1") && grid_snapshot.contains("[ Pane #3 ]") + grid_snapshot.contains("Pane #1") && grid_snapshot.contains(&selected_entry("Pane #3")) }); let (entry_column, entry_line) = entry_click_coordinates(&grid_snapshot, "Pane #1"); zellij.send_stdin(&sgr_left_click(entry_column, entry_line)); let swapped_in = zellij.wait_until("clicked member swapped in", |grid_snapshot| { grid_snapshot.contains("<g> LOCK") - && grid_snapshot.contains("[ Pane #1 ]") + && grid_snapshot.contains(&selected_entry("Pane #1")) && grid_snapshot.contains("first-member") }); assert_snapshot!(normalized(&swapped_in)); @@ -385,7 +393,7 @@ fn alt_clicking_a_hidden_entry_marks_it_without_selecting() { build_three_member_stack(&zellij); let grid_snapshot = zellij.wait_until("stack list rendered", |grid_snapshot| { - grid_snapshot.contains("Pane #1") && grid_snapshot.contains("[ Pane #3 ]") + grid_snapshot.contains("Pane #1") && grid_snapshot.contains(&selected_entry("Pane #3")) }); let (entry_column, entry_line) = entry_click_coordinates(&grid_snapshot, "Pane #1"); zellij.send_stdin(&sgr_alt_left_click(entry_column, entry_line)); @@ -393,7 +401,8 @@ fn alt_clicking_a_hidden_entry_marks_it_without_selecting() { zellij.wait_until( "hidden member marked, selection unchanged", |grid_snapshot| { - grid_snapshot.contains("GROUP ACTIONS") && grid_snapshot.contains("[ Pane #3 ]") + grid_snapshot.contains("GROUP ACTIONS") + && grid_snapshot.contains(&selected_entry("Pane #3")) }, ); zellij.quit(); @@ -435,13 +444,13 @@ fn entries_share_a_uniform_width_sized_by_the_widest_title() { let grid_snapshot = zellij.wait_until("mixed-width entries rendered", |grid_snapshot| { grid_snapshot.status_bar_appears() && grid_snapshot.contains("member-command") - && grid_snapshot.contains("[ Pane #1") + && grid_snapshot.contains(&selected_entry("Pane #1")) }); let lines = grid_snapshot.lines(); let selected_entry_line = lines .iter() - .find(|line| line.contains("[ Pane #1")) + .find(|line| line.contains(&selected_entry("Pane #1"))) .expect("selected entry is on a header row"); let hidden_entry_line = lines .iter() @@ -452,14 +461,6 @@ fn entries_share_a_uniform_width_sized_by_the_widest_title() { let hidden_title_column = display_column_of(hidden_entry_line, "member-command") .expect("hidden title is on the line"); assert_eq!(selected_title_column, hidden_title_column); - - let widest_title_width = "member-command".chars().count(); - let closing_bracket_column = - display_column_of(selected_entry_line, "]").expect("selected entry has a closing bracket"); - assert_eq!( - closing_bracket_column, - selected_title_column + widest_title_width + 1 - ); assert_snapshot!(normalized(&grid_snapshot)); zellij.quit(); } @@ -489,7 +490,7 @@ fn a_hidden_held_members_exit_code_shows_on_its_entry() { |grid_snapshot| { grid_snapshot.status_bar_appears() && grid_snapshot.contains("member-command") - && grid_snapshot.contains("[ Pane #1") + && grid_snapshot.contains(&selected_entry("Pane #1")) }, ); @@ -497,7 +498,8 @@ fn a_hidden_held_members_exit_code_shows_on_its_entry() { let grid_snapshot = zellij.wait_until("exit code rendered on the hidden entry", |grid_snapshot| { - grid_snapshot.contains("EXIT CODE: 2") && grid_snapshot.contains("[ Pane #1") + grid_snapshot.contains("EXIT CODE: 2") + && grid_snapshot.contains(&selected_entry("Pane #1")) }); assert_snapshot!(normalized(&grid_snapshot)); zellij.quit(); @@ -523,7 +525,7 @@ fn the_visible_members_scroll_state_shows_on_its_entry() { let grid_snapshot = zellij.wait_until("scroll indicator on the entry row", |grid_snapshot| { grid_snapshot.contains("SCROLL: ") && !grid_snapshot.contains("SCROLL: 0/") - && grid_snapshot.contains("[ Pane #2 ]") + && grid_snapshot.contains(&selected_entry("Pane #2")) && grid_snapshot.contains("PgDn|PgUp") }); assert_snapshot!(normalized(&grid_snapshot)); @@ -589,7 +591,7 @@ fn a_scrollback_editor_follows_its_member_through_selection_changes() { editor.exit(Some(0)); zellij.wait_until("editor closed back into its member", |grid_snapshot| { - grid_snapshot.contains("[ Pane #2 ]") + grid_snapshot.contains(&selected_entry("Pane #2")) && grid_snapshot.contains("second-member") && !grid_snapshot.contains("editor-open") }); @@ -613,7 +615,7 @@ fn a_hidden_scrollback_editor_pair_survives_fullscreen() { zellij.send_stdin(&keys::ctrl('p')); zellij.send_stdin(&keys::key('f')); zellij.wait_until("list re-formed after fullscreen", |grid_snapshot| { - grid_snapshot.contains("[ Pane #1") && grid_snapshot.contains("first-member") + grid_snapshot.contains(&selected_entry("Pane #1")) && grid_snapshot.contains("first-member") }); zellij.send_stdin(&keys::alt('j')); @@ -623,7 +625,8 @@ fn a_hidden_scrollback_editor_pair_survives_fullscreen() { editor.exit(Some(0)); zellij.wait_until("editor closed back into its member", |grid_snapshot| { - grid_snapshot.contains("[ Pane #2 ]") && grid_snapshot.contains("second-member") + grid_snapshot.contains(&selected_entry("Pane #2")) + && grid_snapshot.contains("second-member") }); zellij.quit(); } @@ -644,7 +647,8 @@ fn closing_a_hidden_editor_member_substitutes_its_parked_pane() { zellij.send_stdin(&keys::alt('j')); zellij.wait_until("substituted member swapped in", |grid_snapshot| { - grid_snapshot.contains("[ Pane #2 ]") && grid_snapshot.contains("second-member") + grid_snapshot.contains(&selected_entry("Pane #2")) + && grid_snapshot.contains("second-member") }); zellij.quit(); } @@ -663,7 +667,7 @@ fn splitting_a_new_pane_reforms_the_list_around_it() { grid_snapshot.contains("<g> LOCK") && grid_snapshot.contains("Pane #1") && grid_snapshot.contains("Pane #2") - && grid_snapshot.contains("[ Pane #3 ]") + && grid_snapshot.contains(&selected_entry("Pane #3")) && grid_snapshot.contains("Pane #4") }); assert_snapshot!(normalized(&grid_snapshot)); @@ -678,12 +682,12 @@ fn resizing_the_visible_member_keeps_the_list() { let _lower_terminal = split_down_and_wait_for_prompt(&zellij); add_stacked_pane_and_wait_for_selected_entry(&zellij, "Pane #3"); let before_resize = zellij.wait_until("list settled before resize", |grid_snapshot| { - grid_snapshot.contains("<g> LOCK") && grid_snapshot.contains("[ Pane #3 ]") + grid_snapshot.contains("<g> LOCK") && grid_snapshot.contains(&selected_entry("Pane #3")) }); let entry_row_before = before_resize .lines() .iter() - .position(|line| line.contains("[ Pane #3 ]")) + .position(|line| line.contains(&selected_entry("Pane #3"))) .expect("selected entry is on a header row"); zellij.send_stdin(&keys::ctrl('n')); @@ -696,7 +700,7 @@ fn resizing_the_visible_member_keeps_the_list() { && grid_snapshot .lines() .iter() - .position(|line| line.contains("[ Pane #3 ]")) + .position(|line| line.contains(&selected_entry("Pane #3"))) .map_or(false, |entry_row| entry_row < entry_row_before) }); assert_snapshot!(normalized(&grid_snapshot)); @@ -726,7 +730,7 @@ fn moving_the_visible_member_reorders_the_list() { grid_snapshot.contains("<g> LOCK") && grid_snapshot.contains("third-member") && matches!( - (row_of("[ Pane #3 ]"), row_of("Pane #2")), + (row_of(&selected_entry("Pane #3")), row_of("Pane #2")), (Some(selected_row), Some(hidden_row)) if selected_row < hidden_row ) }); @@ -755,7 +759,7 @@ fn a_stack_list_survives_session_resurrection() { grid_snapshot.status_bar_appears() && grid_snapshot.contains("Pane #1") && grid_snapshot.contains("Pane #2") - && grid_snapshot.contains("[ Pane #3 ]") + && grid_snapshot.contains(&selected_entry("Pane #3")) }); assert_snapshot!(normalized(&grid_snapshot)); zellij.quit(); diff --git a/zellij-integration-tests/tests/title_frame_hints.rs b/zellij-integration-tests/tests/title_frame_hints.rs index 5f841486..fa39117e 100644 --- a/zellij-integration-tests/tests/title_frame_hints.rs +++ b/zellij-integration-tests/tests/title_frame_hints.rs @@ -2,7 +2,7 @@ use zellij_integration_tests::{ claim_first_terminal_and_wait_for_prompt, keys, split_right_and_wait_for_prompt, FakePtyHandle, - Size, TestRunner, TestSession, PROMPT, + GridSnapshot, Size, TestRunner, TestSession, PROMPT, }; const FOCUSED_PANE_COLUMN: usize = 90; @@ -31,6 +31,10 @@ fn sgr_motion(column: usize, line: usize) -> Vec<u8> { format!("\u{1b}[<35;{};{}M", column, line).into_bytes() } +fn tab_bar_line(grid_snapshot: &GridSnapshot) -> String { + grid_snapshot.lines().first().cloned().unwrap_or_default() +} + fn two_pane_session_with_handles() -> (TestSession, FakePtyHandle, FakePtyHandle) { let zellij = start_zellij_with_mouse(); let left_terminal = claim_first_terminal_and_wait_for_prompt(&zellij); @@ -67,19 +71,19 @@ fn full_frame_two_pane_session(cols: usize) -> TestSession { } #[test] -fn hovering_a_pane_shows_a_hint_on_the_status_bar() { +fn hovering_a_pane_shows_a_hint_on_the_tab_bar() { let mut zellij = two_pane_session(); zellij.send_stdin(&sgr_motion(FOCUSED_PANE_COLUMN, HOVER_LINE)); zellij.wait_until( - "resize hint shown when hovering the focused pane", - |grid_snapshot| grid_snapshot.contains("resize"), + "resize hint shown on the tab bar when hovering the focused pane", + |grid_snapshot| tab_bar_line(grid_snapshot).contains("resize"), ); zellij.send_stdin(&sgr_motion(OTHER_PANE_COLUMN, HOVER_LINE)); zellij.wait_until( - "group hint shown when hovering the other pane", - |grid_snapshot| grid_snapshot.contains("group"), + "group hint shown on the tab bar when hovering the other pane", + |grid_snapshot| tab_bar_line(grid_snapshot).contains("group"), ); zellij.quit(); @@ -143,13 +147,19 @@ fn hint_only_re_fires_when_entering_a_different_pane() { } #[test] -fn full_frame_help_renders_on_the_pane_not_the_status_bar() { +fn full_frame_help_renders_on_the_pane_not_the_tab_bar() { let mut zellij = full_frame_two_pane_session(120); zellij.send_stdin(&sgr_motion(FOCUSED_PANE_COLUMN, HOVER_LINE)); let grid_snapshot = zellij.wait_until("resize help drawn on the pane frame", |grid_snapshot| { grid_snapshot.contains("to resize") }); + let tab_bar = tab_bar_line(&grid_snapshot); + assert!( + !tab_bar.contains("resize"), + "in full-frame mode the resize help belongs on the pane frame, not the tab bar:\n{}", + grid_snapshot.text + ); let status_bar = grid_snapshot.lines().last().cloned().unwrap(); assert!( !status_bar.contains("resize"), @@ -161,20 +171,55 @@ fn full_frame_help_renders_on_the_pane_not_the_status_bar() { } #[test] -fn resize_hint_shortens_when_the_status_bar_narrows() { +fn resize_hint_shortens_when_the_tab_bar_narrows() { let mut zellij = two_pane_session(); zellij.send_stdin(&sgr_motion(FOCUSED_PANE_COLUMN, HOVER_LINE)); zellij.wait_until( - "full-width status bar shows the long resize hint", - |grid_snapshot| grid_snapshot.contains("to resize"), + "full-width tab bar shows the long resize hint", + |grid_snapshot| tab_bar_line(grid_snapshot).contains("to resize"), + ); + + zellij.resize(Size { cols: 68, rows: 24 }); + zellij.wait_until( + "narrowed tab bar shortens the resize hint", + |grid_snapshot| { + let tab_bar = tab_bar_line(grid_snapshot); + tab_bar.contains("drag borders") && !tab_bar.contains("to resize") + }, + ); + + zellij.resize(Size { cols: 50, rows: 24 }); + zellij.wait_until( + "very narrow tab bar drops the hint and keeps the tabs", + |grid_snapshot| !grid_snapshot.contains("drag borders") && grid_snapshot.tab_bar_appears(), ); - zellij.resize(Size { cols: 46, rows: 24 }); + zellij.quit(); +} + +#[test] +fn hint_replaces_the_swap_layout_indicator_until_dismissed() { + let mut zellij = two_pane_session(); + zellij.wait_until("swap layout indicator shown", |grid_snapshot| { + tab_bar_line(grid_snapshot).contains("BASE") + }); + + zellij.send_stdin(&sgr_motion(FOCUSED_PANE_COLUMN, HOVER_LINE)); + zellij.wait_until( + "hint takes over the swap layout indicator slot", + |grid_snapshot| { + let tab_bar = tab_bar_line(grid_snapshot); + tab_bar.contains("resize") && !tab_bar.contains("BASE") + }, + ); + + zellij.send_stdin(b"x"); zellij.wait_until( - "narrowed status bar shortens the resize hint", + "swap layout indicator returns after the hint is dismissed", |grid_snapshot| { - grid_snapshot.contains("drag borders") && !grid_snapshot.contains("to resize") + let tab_bar = tab_bar_line(grid_snapshot); + tab_bar.contains("BASE") && !tab_bar.contains("resize") }, ); diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index 18f3e0a7..45657176 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -1107,7 +1107,7 @@ impl Tab { } else { self.reserved_top_rows .borrow_mut() - .insert(visible, member_count); + .insert(visible, member_count + 1); self.tiled_panes.reapply_pane_frames(); self.resize_stack_list_hidden_members(stack_list_id); } @@ -1547,6 +1547,7 @@ impl Tab { .map(|pane| pane.stack_list_entry_label().width()) .max() .unwrap_or(0); + let stack_is_focused = active_panes.values().any(|p_id| *p_id == list.visible); for (rank, member) in list.members.iter().enumerate() { let mut header_geom = rect; header_geom.y = rect.y + rank; @@ -1577,8 +1578,11 @@ impl Tab { false, ); pane_contents_and_ui.set_frame_geom_override(Some(header_geom)); - pane_contents_and_ui - .set_stack_list_entry(Some(widest_member_title), *member == list.visible); + pane_contents_and_ui.set_stack_list_entry( + Some(widest_member_title), + *member == list.visible, + stack_is_focused, + ); for (client_id, client_mode) in &client_modes { pane_contents_and_ui.render_pane_frame( *client_id, diff --git a/zellij-server/src/ui/pane_boundaries_frame.rs b/zellij-server/src/ui/pane_boundaries_frame.rs index e4e182dc..73420336 100644 --- a/zellij-server/src/ui/pane_boundaries_frame.rs +++ b/zellij-server/src/ui/pane_boundaries_frame.rs @@ -71,6 +71,7 @@ pub struct StackListEntry { pub label: String, pub is_selected: bool, pub is_emphasized: bool, + pub stack_is_focused: bool, } pub struct FrameParams { @@ -743,10 +744,9 @@ impl PaneFrame { } fn render_stack_list_entry(&self, entry: &StackListEntry) -> Vec<TerminalCharacter> { let usable_cols = self.geom.cols.saturating_sub(2); - let bracket_overhead = "[ ]".width(); - let inner_width = entry - .width - .min(usable_cols.saturating_sub(bracket_overhead)); + let selection_marker = "> "; + let marker_width = selection_marker.width(); + let inner_width = entry.width.min(usable_cols.saturating_sub(marker_width)); let content = if entry.label.width() <= inner_width { entry.label.clone() } else { @@ -761,19 +761,9 @@ impl PaneFrame { truncated.push('…'); truncated }; - let padding = " ".repeat(inner_width.saturating_sub(content.width())); - let padded_content = format!("{}{}", content, padding); - let left_bracket = "[ "; - let right_bracket = " ]"; - let entry_length = left_bracket.width() + padded_content.width() + right_bracket.width(); - let entry_start = usable_cols.saturating_sub(entry_length) / 2; - let selection_sign = "<↓↑> "; - let selection_sign_width = if entry.is_selected && entry_start >= selection_sign.width() { - selection_sign.width() - } else { - 0 - }; - let left_budget = entry_start.saturating_sub(selection_sign_width); + let full_width_entry_length = marker_width + inner_width; + let entry_start = usable_cols.saturating_sub(full_width_entry_length) / 2; + let left_budget = entry_start; let (mut focus_part, focus_length) = self .bracketed_focus_indicator(left_budget) .unwrap_or((vec![], 0)); @@ -782,27 +772,27 @@ impl PaneFrame { for _ in focus_length..left_budget { line.push(EMPTY_TERMINAL_CHARACTER); } - if selection_sign_width > 0 { - line.append(&mut foreground_color(selection_sign, self.color)); - } - let content_color = if entry.is_emphasized { - self.color - } else { - self.color_override - }; + let unfocused_color = self.style.colors.frame_unselected.map(|frame| frame.base); if entry.is_selected { - line.append(&mut foreground_color(left_bracket, self.color_override)); - line.append(&mut foreground_color(&padded_content, self.color)); - line.append(&mut foreground_color(right_bracket, self.color_override)); + line.append(&mut foreground_color(selection_marker, None)); } else { - let unbracketed = format!(" {} ", padded_content); - if entry.is_emphasized { - line.append(&mut foreground_color(&unbracketed, content_color)); - } else { - line.append(&mut dimmed_foreground_color(&unbracketed, content_color)); + for _ in 0..marker_width { + line.push(EMPTY_TERMINAL_CHARACTER); } } - let mut occupied_columns = entry_start + entry_length; + let mut styled_content = if entry.is_selected || entry.is_emphasized { + foreground_color(&content, self.color) + } else if entry.stack_is_focused { + foreground_color(&content, unfocused_color) + } else { + dimmed_foreground_color(&content, unfocused_color) + }; + line.append(&mut styled_content); + let entry_padding = full_width_entry_length.saturating_sub(marker_width + content.width()); + for _ in 0..entry_padding { + line.push(EMPTY_TERMINAL_CHARACTER); + } + let mut occupied_columns = entry_start + full_width_entry_length; let (mut scroll_part, scroll_length) = self .bracketed_scroll_indicator(usable_cols.saturating_sub(occupied_columns)) .unwrap_or((vec![], 0)); diff --git a/zellij-server/src/ui/pane_contents_and_ui.rs b/zellij-server/src/ui/pane_contents_and_ui.rs index fc72bf0f..2f260620 100644 --- a/zellij-server/src/ui/pane_contents_and_ui.rs +++ b/zellij-server/src/ui/pane_contents_and_ui.rs @@ -25,6 +25,7 @@ pub struct PaneContentsAndUi<'a> { frame_geom_override: Option<PaneGeom>, stack_list_entry_width: Option<usize>, stack_list_entry_is_selected: bool, + stack_list_entry_stack_is_focused: bool, blank_title: bool, } @@ -77,6 +78,7 @@ impl<'a> PaneContentsAndUi<'a> { frame_geom_override: None, stack_list_entry_width: None, stack_list_entry_is_selected: false, + stack_list_entry_stack_is_focused: false, blank_title: false, } } @@ -90,9 +92,11 @@ impl<'a> PaneContentsAndUi<'a> { &mut self, stack_list_entry_width: Option<usize>, stack_list_entry_is_selected: bool, + stack_list_entry_stack_is_focused: bool, ) { self.stack_list_entry_width = stack_list_entry_width; self.stack_list_entry_is_selected = stack_list_entry_is_selected; + self.stack_list_entry_stack_is_focused = stack_list_entry_stack_is_focused; } pub fn render_pane_contents_to_multiple_clients( &mut self, @@ -275,6 +279,7 @@ impl<'a> PaneContentsAndUi<'a> { width, label: self.pane.stack_list_entry_label(), is_selected: self.stack_list_entry_is_selected, + stack_is_focused: self.stack_list_entry_stack_is_focused, is_emphasized: pane_is_in_group || (self .mouse_is_hovering_over_pane_for_clients diff --git a/zellij-utils/assets/plugins/about.wasm b/zellij-utils/assets/plugins/about.wasm Binary files differindex b36db1c4..5f8c923e 100755 --- a/zellij-utils/assets/plugins/about.wasm +++ b/zellij-utils/assets/plugins/about.wasm diff --git a/zellij-utils/assets/plugins/compact-bar.wasm b/zellij-utils/assets/plugins/compact-bar.wasm Binary files differindex 58b5f638..0f55fac9 100755 --- a/zellij-utils/assets/plugins/compact-bar.wasm +++ b/zellij-utils/assets/plugins/compact-bar.wasm diff --git a/zellij-utils/assets/plugins/configuration.wasm b/zellij-utils/assets/plugins/configuration.wasm Binary files differindex cf12f093..dcd848fa 100755 --- a/zellij-utils/assets/plugins/configuration.wasm +++ b/zellij-utils/assets/plugins/configuration.wasm diff --git a/zellij-utils/assets/plugins/fixture-plugin-for-tests.wasm b/zellij-utils/assets/plugins/fixture-plugin-for-tests.wasm Binary files differindex 0877d78a..ccde7690 100755 --- a/zellij-utils/assets/plugins/fixture-plugin-for-tests.wasm +++ b/zellij-utils/assets/plugins/fixture-plugin-for-tests.wasm diff --git a/zellij-utils/assets/plugins/layout-manager.wasm b/zellij-utils/assets/plugins/layout-manager.wasm Binary files differindex d41686c5..c5382f72 100755 --- a/zellij-utils/assets/plugins/layout-manager.wasm +++ b/zellij-utils/assets/plugins/layout-manager.wasm diff --git a/zellij-utils/assets/plugins/link.wasm b/zellij-utils/assets/plugins/link.wasm Binary files differindex dc5b14ec..32d2aba3 100755 --- a/zellij-utils/assets/plugins/link.wasm +++ b/zellij-utils/assets/plugins/link.wasm diff --git a/zellij-utils/assets/plugins/mobile.wasm b/zellij-utils/assets/plugins/mobile.wasm Binary files differindex 65ae6f64..05bd6516 100755 --- a/zellij-utils/assets/plugins/mobile.wasm +++ b/zellij-utils/assets/plugins/mobile.wasm diff --git a/zellij-utils/assets/plugins/multiple-select.wasm b/zellij-utils/assets/plugins/multiple-select.wasm Binary files differindex 9ed820ed..036a726e 100755 --- a/zellij-utils/assets/plugins/multiple-select.wasm +++ b/zellij-utils/assets/plugins/multiple-select.wasm diff --git a/zellij-utils/assets/plugins/plugin-manager.wasm b/zellij-utils/assets/plugins/plugin-manager.wasm Binary files differindex b761818a..2d4caf64 100755 --- a/zellij-utils/assets/plugins/plugin-manager.wasm +++ b/zellij-utils/assets/plugins/plugin-manager.wasm diff --git a/zellij-utils/assets/plugins/session-manager.wasm b/zellij-utils/assets/plugins/session-manager.wasm Binary files differindex 03c8e421..61e16dd8 100755 --- a/zellij-utils/assets/plugins/session-manager.wasm +++ b/zellij-utils/assets/plugins/session-manager.wasm diff --git a/zellij-utils/assets/plugins/share.wasm b/zellij-utils/assets/plugins/share.wasm Binary files differindex 53622d68..fa0fb2e7 100755 --- a/zellij-utils/assets/plugins/share.wasm +++ b/zellij-utils/assets/plugins/share.wasm diff --git a/zellij-utils/assets/plugins/status-bar.wasm b/zellij-utils/assets/plugins/status-bar.wasm Binary files differindex c70dff5d..70a76358 100755 --- a/zellij-utils/assets/plugins/status-bar.wasm +++ b/zellij-utils/assets/plugins/status-bar.wasm diff --git a/zellij-utils/assets/plugins/strider.wasm b/zellij-utils/assets/plugins/strider.wasm Binary files differindex 8e0ad467..9197346b 100755 --- a/zellij-utils/assets/plugins/strider.wasm +++ b/zellij-utils/assets/plugins/strider.wasm diff --git a/zellij-utils/assets/plugins/tab-bar.wasm b/zellij-utils/assets/plugins/tab-bar.wasm Binary files differindex 2a1bb455..f52aa749 100755 --- a/zellij-utils/assets/plugins/tab-bar.wasm +++ b/zellij-utils/assets/plugins/tab-bar.wasm |
