diff options
| author | user <user@clank> | 2026-08-08 20:05:45 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-08 20:05:45 +0200 |
| commit | e118b6977086f5043422ab5763cda91ce6cae44f (patch) | |
| tree | d75862e2c3407006edd6ef6b09d2d9466f3a0f50 /zellij-server | |
| parent | sl0p: configurable pane gap (outer) and padding (inner) (diff) | |
| download | sl0ppij-e118b6977086f5043422ab5763cda91ce6cae44f.tar.gz sl0ppij-e118b6977086f5043422ab5763cda91ce6cae44f.tar.xz sl0ppij-e118b6977086f5043422ab5763cda91ce6cae44f.zip | |
sl0p: fix status bar vanishing when pane gap is set
REGRESSION from 30782cbb: with `gap 1` the zjstatus footer disappeared.
A status bar is a size=1 borderless pane. set_content_offset expanded it by
the gap on every side, giving top = bottom = 1 and therefore
rows - (top + bottom) = 0 content rows, so it rendered nothing at all. The
same applied to the tab bar and any other chrome pane sized exactly to its
content.
Two independent fixes, because either alone would leave a sharp edge:
1. Callers skip the inset for `borderless` panes. Chrome is sized exactly to
its content and is not part of the tiled pane grid the gap is meant to
separate, so it should never be inset.
2. Offset::expanded_by_within() refuses any expansion that would leave a pane
with less than one row or column of content, and returns the original
offset instead. Panes can be resized down to almost nothing at runtime, so
the geometry must not depend on callers being careful.
Tests encode the exact regression (a 1-row pane must keep >= 1 content row)
plus an exhaustive sweep over pane sizes 1..12 x gaps 0..4 asserting that
expansion never reduces content below what the incoming offset already
allowed.
Diffstat (limited to 'zellij-server')
| -rw-r--r-- | zellij-server/src/panes/plugin_pane.rs | 10 | ||||
| -rw-r--r-- | zellij-server/src/panes/terminal_pane.rs | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/zellij-server/src/panes/plugin_pane.rs b/zellij-server/src/panes/plugin_pane.rs index 4d30cb4b..534a149c 100644 --- a/zellij-server/src/panes/plugin_pane.rs +++ b/zellij-server/src/panes/plugin_pane.rs @@ -715,7 +715,15 @@ impl Pane for PluginPane { self.frame.clear(); } fn set_content_offset(&mut self, offset: Offset) { - self.content_offset = offset.expanded_by(self.style.pane_gap + self.style.pane_padding); + // see terminal_pane.rs: borderless panes are chrome (this is the one + // that matters in practice - zjstatus/status-bar/tab-bar are plugins) + let inset = if self.borderless { + 0 + } else { + self.style.pane_gap + self.style.pane_padding + }; + self.content_offset = + offset.expanded_by_within(inset, self.cols(), self.rows()); self.resize_grids(); } diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs index ab17c7c5..709c3dfd 100644 --- a/zellij-server/src/panes/terminal_pane.rs +++ b/zellij-server/src/panes/terminal_pane.rs @@ -935,7 +935,15 @@ impl Pane for TerminalPane { } fn set_content_offset(&mut self, offset: Offset) { - self.content_offset = offset.expanded_by(self.style.pane_gap + self.style.pane_padding); + // borderless panes are UI chrome (status bar, tab bar): they are sized + // exactly to their content, so insetting them makes them vanish + let inset = if self.borderless { + 0 + } else { + self.style.pane_gap + self.style.pane_padding + }; + self.content_offset = + offset.expanded_by_within(inset, self.get_columns(), self.get_rows()); self.reflow_lines(); } |
