summaryrefslogtreecommitdiff
path: root/src/Finder.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-28 17:56:30 -0300
committerGabriel Schneider <[email protected]>2026-10-28 21:05:25 -0300
commit96f840a055651b88eb1191772bc4b10fcbbb60ce (patch)
tree55ccd6e05fc1f7419f1fef3fb2c7116b556c85d2 /src/Finder.zig
parentf8c27dbfa9afca327189181a668f2191b499bea5 (diff)
downloadpardes-96f840a055651b88eb1191772bc4b10fcbbb60ce.tar.gz
pardes-96f840a055651b88eb1191772bc4b10fcbbb60ce.zip
layout: a new pane takes rows only from the pane it splits, as acme's coladd does: no column shared out evenly after a placement (only a pane the rounding squeezed, and the new one, lifted to their minimum, restoreMinimaFrom), none when there is no pane to halve (takeRoom: its minimum from the panes with the most to spare), none after a refused pane (it held no weight; absorbVWeight gives back and snaps nothing for it), none after Newcol or the finder column (only a pane whose tag now wraps past its rows is lifted, squeezed); a pane dragged short keeps its rows through all of them; test: a pane made from the middle between two short ones, then Newcol
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/Finder.zig')
-rw-r--r--src/Finder.zig13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Finder.zig b/src/Finder.zig
index a2b8f89f..e72a8dab 100644
--- a/src/Finder.zig
+++ b/src/Finder.zig
@@ -73,6 +73,8 @@ pub fn place(f: *Finder, p: *Pardes, id: usize) bool {
fn open(f: *Finder, p: *Pardes) ?usize {
if (p.ncol >= pardes.MAX_COLS or p.ncol == 0) return null;
if (p.screen_w < @as(u32, config.MINW) * @as(u32, @intCast(p.ncol + 1))) return null;
+ const before_min = layout.minima(p);
+ const before = p.rects;
const c = p.ncol;
p.col_n[c] = 0;
// Not used for its width (layout.compute), only kept positive for the
@@ -83,11 +85,12 @@ fn open(f: *Finder, p: *Pardes) ?usize {
p.col_serial[c] = 0;
p.ncol += 1;
f.serial = layout.columnSerial(p, c);
- // A narrower column wraps long tags onto more rows: shared out again,
- // and where that cannot hold every minimum there is no finder, as
- // Newcol is refused.
- layout.compute(p);
- for (0..p.ncol) |k| if (k != c and !layout.columnAtMinimums(p, k) and !layout.shareColumn(p, k)) {
+ // A narrower column wraps long tags onto more rows: those rows back
+ // from the panes with rows to spare, shared out again only where that
+ // is not enough, and where nothing holds every minimum there is no
+ // finder, as Newcol is refused.
+ layout.restoreMinimaFrom(p, &before, &before_min);
+ for (0..p.ncol) |k| if (k != c and layout.squeezed(p, k, &before, &before_min) and !layout.shareColumn(p, k)) {
layout.dropColumnUnannounced(p, c);
f.serial = 0;
layout.compute(p);