atagen

monolith

public
Star0
Watch0

Commit 1c8e1b4009f5

tarball

atagen <boss@atagen.co>2026-10-17 00:58 UTC

2 files changed+8-0
layout: collapse a tree whose every window is hidden

A root leaf was placed over the whole area whatever its visibility, so the only window on a tag stayed on screen after the tag was hidden. Containers already collapsed hidden children, which is why a second window seemed to fix it. The proptest now asserts that hidden tiles have no area.
Modified file: crates/layout/src/tests.rs+3 additions
@@ -137,6 +137,9 @@ fn check_geometry(l: &Layout) {
137137 .filter(|p| p.visible)
138138 .map(|p| p.rect)
139139 .collect();
140+ for p in arr.tiled.iter().filter(|p| !p.visible) {
141+ assert!(p.rect.w * p.rect.h <= 1e-6, "hidden {:?} has area", p.rect);
142+ }
140143 for r in &shown {
141144 assert!(r.w >= 0.0 && r.h >= 0.0);
142145 assert!(r.x >= out.area.x - 1e-6 && r.right() <= out.area.right() + 1e-6);
Modified file: crates/layout/src/tree.rs+5 additions
@@ -306,6 +306,11 @@ impl<W: Copy + Eq + Hash> Tree<W> {
306306 pub fn arrange(&self, area: Rect, gap: f64, vis: impl Fn(W) -> bool) -> Vec<(W, Rect)> {
307307 let mut out = Vec::with_capacity(self.leaves.len());
308308 if let Some(r) = self.root {
309+ let area = if self.visible(r, &vis) {
310+ area
311+ } else {
312+ Rect::new(area.x + area.w / 2.0, area.y, 0.0, area.h)
313+ };
309314 self.place(r, area, gap, &vis, &mut out);
310315 }
311316 out