aboutsummaryrefslogtreecommitdiffstats
path: root/sl0ppij/zellij-server/src/tab
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-11 20:26:57 +0200
committeruser <user@clank>2026-08-12 19:34:19 +0200
commit1e975c71f85f8dd34c27af32ce5bd2405194fe77 (patch)
treedad417b1fa27f2044bae5e9231ef553e68d139ce /sl0ppij/zellij-server/src/tab
parentsl0p: add a minimal style for the stacked-pane picker (diff)
downloadsl0ppi-1e975c71f85f8dd34c27af32ce5bd2405194fe77.tar.gz
sl0ppi-1e975c71f85f8dd34c27af32ce5bd2405194fe77.tar.xz
sl0ppi-1e975c71f85f8dd34c27af32ce5bd2405194fe77.zip
sl0p: keep plugin panes pinned when synthesizing a layout
Collapsing and expanding a tab from the default layout stranded the status bar halfway down the screen, and left the collapsed stack three rows tall. A synthesized layout describes only where the user's panes go. Applied bare, it laid out EVERY pane in the tab -- including the status bar, which became an ordinary grid cell. Real swap layouts do not hit this because their `tab` node is expanded with the default tab template, which carries the pinned plugin slots; a layout built at runtime has to take those from BASE instead. Synthesis now builds into the tab's own structure: the first non-plugin leaf becomes the stack or grid and inherits its size, further content leaves are dropped since the replacement accounts for every pane itself, and plugin panes keep their slots and sizes. Falls back to the bare replacement when there is no content slot at all -- a layout of nothing but plugin panes would otherwise be returned unchanged, silently dropping every user pane. Found by the test, not by the drive. Only reproducible with a layout that has plugin panes, which is why the quaddie.kdl drives never showed it and the default layout did immediately.
Diffstat (limited to 'sl0ppij/zellij-server/src/tab')
-rw-r--r--sl0ppij/zellij-server/src/tab/swap_layouts.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/sl0ppij/zellij-server/src/tab/swap_layouts.rs b/sl0ppij/zellij-server/src/tab/swap_layouts.rs
index 2739444..016ba5f 100644
--- a/sl0ppij/zellij-server/src/tab/swap_layouts.rs
+++ b/sl0ppij/zellij-server/src/tab/swap_layouts.rs
@@ -129,12 +129,32 @@ impl SwapLayouts {
if let Some(existing) = self.position_of_tiled_layout_named(name) {
return existing;
}
+ // Build it into the tab's own structure rather than replacing it, so
+ // plugin panes (status bar, tab bar) keep their pinned slots. Real swap
+ // layouts get this from the default tab template; a runtime-built one
+ // has to take it from BASE.
+ let layout = match self.base_tiled_layout() {
+ Some(base) => base.with_content_replaced_by(&layout),
+ None => layout,
+ };
let mut constraints = BTreeMap::new();
constraints.insert(constraint, layout);
self.swap_tiled_layouts
.push((constraints, Some(name.to_string())));
self.swap_tiled_layouts.len() - 1
}
+ /// The tab's own layout, as inserted by set_base_layout. Carries the plugin
+ /// pane slots a synthesized layout has to preserve.
+ fn base_tiled_layout(&self) -> Option<TiledPaneLayout> {
+ let position = self.position_of_tiled_layout_named(BASE_LAYOUT_NAME)?;
+ self.swap_tiled_layouts
+ .iter()
+ .nth(position)?
+ .0
+ .values()
+ .next()
+ .cloned()
+ }
/// Position of the swap tiled layout with this name, if any.
///
/// Used by the responsive-layout switch, which selects a layout BY NAME