diff options
| author | user <user@clank> | 2026-08-08 19:49:23 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-08 19:49:23 +0200 |
| commit | 30782cbb2fab4e01cadb9815927a404591472064 (patch) | |
| tree | 29bdd07fc0c56c7ec38b1238066f1ae0ee6e53c5 /zellij-utils/src/input | |
| parent | sl0p: configurable pane title alignment (diff) | |
| download | sl0ppij-30782cbb2fab4e01cadb9815927a404591472064.tar.gz sl0ppij-30782cbb2fab4e01cadb9815927a404591472064.tar.xz sl0ppij-30782cbb2fab4e01cadb9815927a404591472064.zip | |
sl0p: configurable pane gap (outer) and padding (inner)
Adds `ui { pane_frames { gap N; padding N } }`, both defaulting to 0 so
stock configs are unaffected.
gap - cells each pane gives up on every side, leaving real empty
terminal between neighbouring panes (WM-style outer gaps).
Two adjacent panes therefore show 2*gap between them.
padding - cells between a pane's frame and its content; breathing room
inside the pane without moving the frame.
Design: the pane KEEPS its allocated PaneGeom. Only two things move:
1. the drawn frame, via Viewport::inset(gap), reusing the existing
frame_geom_override mechanism already used for stacked panes;
2. the content, via Offset::expanded_by(gap + padding) inside
set_content_offset.
Because the allocation is untouched, the kasuari resize solver and mouse
hit-testing need no changes at all, and a click landing in a gap still
resolves to the owning pane. Content position, size and cursor are all
derived from content_offset, so widening it in one place keeps every
consumer consistent.
Viewport::inset refuses to shrink a pane below a frame's minimum viable
extent (two borders + one content cell) rather than emitting a degenerate
or zero-sized frame. Negative KDL values clamp to 0 instead of wrapping.
Tests cover: inset identity/shrink/recentre, the containment invariant
(an inset frame never escapes its allocation), small-pane refusal, and
the key safety property that content inset by gap+border+padding lands
strictly inside the frame drawn at inset(gap).
Diffstat (limited to 'zellij-utils/src/input')
| -rw-r--r-- | zellij-utils/src/input/config.rs | 2 | ||||
| -rw-r--r-- | zellij-utils/src/input/theme.rs | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs index 9387aef3..546d39d0 100644 --- a/zellij-utils/src/input/config.rs +++ b/zellij-utils/src/input/config.rs @@ -1408,6 +1408,8 @@ mod config_test { rounded_corners: true, hide_session_name: true, title_alignment: Default::default(), + gap: Default::default(), + padding: Default::default(), }, }; 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 0930bc15..949a8752 100644 --- a/zellij-utils/src/input/theme.rs +++ b/zellij-utils/src/input/theme.rs @@ -27,6 +27,10 @@ pub struct FrameConfig { pub rounded_corners: bool, pub hide_session_name: bool, pub title_alignment: crate::data::PaneTitleAlignment, + /// outer gap between panes, in cells (see Style::pane_gap) + pub gap: usize, + /// inner padding between a pane's frame and its content (see Style::pane_padding) + pub padding: usize, } impl FrameConfig { @@ -35,6 +39,8 @@ impl FrameConfig { merged.rounded_corners = other.rounded_corners; merged.hide_session_name = other.hide_session_name; merged.title_alignment = other.title_alignment; + merged.gap = other.gap; + merged.padding = other.padding; merged } } |
