diff options
| author | user <user@clank> | 2026-08-11 16:33:46 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-11 16:33:46 +0200 |
| commit | 4e001669f5a9dcc883f58bf0c3710c7460ae93cc (patch) | |
| tree | 116fae3213fd781ea62b15c05256831f2ec9843e /zellij-utils/src/input | |
| parent | sl0p: click the picker's indicator row to expand a capped stack (diff) | |
| download | sl0ppij-4e001669f5a9dcc883f58bf0c3710c7460ae93cc.tar.gz sl0ppij-4e001669f5a9dcc883f58bf0c3710c7460ae93cc.tar.xz sl0ppij-4e001669f5a9dcc883f58bf0c3710c7460ae93cc.zip | |
sl0p: optionally render the stacked-pane picker as a grid
`stack_list_layout "grid"` packs picker entries several per row, which turns
stack_list_max_rows from a count into a space budget: eight panes in a wide
terminal now fit on one row instead of spending three and hiding five.
The entry renderer already drew each entry as a single chunk at its own x/y,
sized by its geom and centring its own label, so a grid needed no rendering
changes at all -- only the loop assigning every entry the same x and the full
width. Column count is derived from the widest label rather than configured, so
it adapts to the titles; one column is the floor and reproduces the previous
full-width rows byte for byte.
The row -> member mapping now has a column axis, and it had already caused one
wrong-pane bug when two consumers disagreed. So the layout is computed once,
by one function, into explicit cells; the renderer, the reserved-row budget and
the mouse hit-test all read those same cells rather than each doing their own
arithmetic. Windowing is by row, so a grid scrolls a whole row at a time and
degrades to the old per-member window when there is one column.
Cells are separated by a two-column gap: without it the focused entry's "> "
marker sits flush against the previous cell and reads as belonging to it.
Diffstat (limited to 'zellij-utils/src/input')
| -rw-r--r-- | zellij-utils/src/input/config.rs | 1 | ||||
| -rw-r--r-- | zellij-utils/src/input/theme.rs | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs index d64e4598..4cb315ca 100644 --- a/zellij-utils/src/input/config.rs +++ b/zellij-utils/src/input/config.rs @@ -1497,6 +1497,7 @@ mod config_test { responsive_min_cols: 0, responsive_layout: String::from("stacked"), stack_list_max_rows: 0, + stack_list_grid: false, }, }; 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 7cd89d41..412aaae2 100644 --- a/zellij-utils/src/input/theme.rs +++ b/zellij-utils/src/input/theme.rs @@ -52,6 +52,9 @@ pub struct FrameConfig { /// 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, + /// Pack picker entries into a grid instead of one per row. The row cap then + /// becomes a space budget rather than a count. + pub stack_list_grid: bool, } /// Hand-written rather than derived: `gap_aspect` must default to 2 to match @@ -72,6 +75,7 @@ impl Default for FrameConfig { responsive_min_cols: 0, responsive_layout: String::from("stacked"), stack_list_max_rows: 0, + stack_list_grid: false, } } } @@ -103,6 +107,7 @@ impl FrameConfig { 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.stack_list_grid = other.stack_list_grid; merged } } |
