diff options
| author | user <user@clank> | 2026-08-11 14:14:53 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-11 14:14:53 +0200 |
| commit | 9441f1b177c1e08f4ceae76ef70d444103d15efa (patch) | |
| tree | bf59f9655fc32e46cd3f6c15e599f5b6dbc10281 /zellij-utils/src/input | |
| parent | sl0p: add `arrangement` to build a tree for N panes (diff) | |
| download | sl0ppij-9441f1b177c1e08f4ceae76ef70d444103d15efa.tar.gz sl0ppij-9441f1b177c1e08f4ceae76ef70d444103d15efa.tar.xz sl0ppij-9441f1b177c1e08f4ceae76ef70d444103d15efa.zip | |
sl0p: cap how many rows the stacked-pane picker takes
A stack reserves one row per member plus a padding row, so a deep stack spends
most of the screen listing itself. `stack_list_max_rows` caps that; the list
windows around the focused member and reports the rest as "+N more".
The indicator goes in the padding row the list already reserves, so it costs
no extra row and never displaces a real entry. Entries keep their real rank
rather than renumbering from 1, otherwise the numbering stops meaning anything
once the window has scrolled. The window slides on ordinary focus movement,
which is also why this needs no new keybinding -- Action is a protobuf enum
and the prost assets cannot be regenerated here (no protoc).
A fixed cap rather than hover-to-expand on purpose: reserved_top_rows feeds
pane geometry, so growing the list on hover would resize the pane's PTY and
reflow whatever is running in it on every mouse move. A real expand/collapse
has to be an overlay that reserves nothing, which is a much larger change to
the render path.
reserved_top_rows and the renderer both go through stack_list_window(); if
they disagreed the list would draw into rows the geometry never reserved, i.e.
over the pane beneath it.
Diffstat (limited to 'zellij-utils/src/input')
| -rw-r--r-- | zellij-utils/src/input/config.rs | 16 | ||||
| -rw-r--r-- | zellij-utils/src/input/theme.rs | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs index 3a105937..d64e4598 100644 --- a/zellij-utils/src/input/config.rs +++ b/zellij-utils/src/input/config.rs @@ -1447,6 +1447,21 @@ mod config_test { } #[test] + fn stack_list_max_rows_is_configurable_and_clamps() { + let contents = "ui {\n pane_frames {\n stack_list_max_rows 4\n }\n}"; + let frames = Config::from_kdl(contents, None).unwrap().ui.pane_frames; + assert_eq!(frames.stack_list_max_rows, 4); + + // negative would wrap to a huge usize and effectively uncap the list + let contents = "ui {\n pane_frames {\n stack_list_max_rows -2\n }\n}"; + let frames = Config::from_kdl(contents, None).unwrap().ui.pane_frames; + assert_eq!( + frames.stack_list_max_rows, 0, + "a negative cap must clamp to 0 (uncapped), not wrap" + ); + } + + #[test] fn negative_responsive_min_cols_clamps_to_disabled() { // parsed as i64 then clamped: a negative threshold is meaningless and // must not wrap around to a huge usize, which would collapse always @@ -1481,6 +1496,7 @@ mod config_test { hide_default_pane_names: false, responsive_min_cols: 0, responsive_layout: String::from("stacked"), + stack_list_max_rows: 0, }, }; assert_eq!(config.ui, expected_ui_config, "Ui config defined in config"); diff --git a/zellij-utils/src/input/theme.rs b/zellij-utils/src/input/theme.rs index 161eb16d..7cd89d41 100644 --- a/zellij-utils/src/input/theme.rs +++ b/zellij-utils/src/input/theme.rs @@ -48,6 +48,10 @@ pub struct FrameConfig { pub responsive_min_cols: usize, /// Name of the swap tiled layout to use when below the threshold. pub responsive_layout: String, + /// Cap on how many entries the stacked-pane picker shows at once. The list + /// windows around the focused entry and reports the rest as "+N". 0 = show + /// every member, however many rows that takes. + pub stack_list_max_rows: usize, } /// Hand-written rather than derived: `gap_aspect` must default to 2 to match @@ -67,6 +71,7 @@ impl Default for FrameConfig { hide_default_pane_names: false, responsive_min_cols: 0, responsive_layout: String::from("stacked"), + stack_list_max_rows: 0, } } } @@ -97,6 +102,7 @@ impl FrameConfig { merged.hide_default_pane_names = other.hide_default_pane_names; merged.responsive_min_cols = other.responsive_min_cols; merged.responsive_layout = other.responsive_layout.clone(); + merged.stack_list_max_rows = other.stack_list_max_rows; merged } } |
