diff options
Diffstat (limited to 'src/layout.zig')
| -rw-r--r-- | src/layout.zig | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/layout.zig b/src/layout.zig index a3fb9b8e..91947997 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -725,17 +725,28 @@ pub fn restoreMinimaFrom(p: *Pardes, before: *const [MAX_PANES]Rect, before_min: compute(p); } -/// Whether a pane of column `c` is under its minimum now that had its -/// minimum then (`before`, `before_min`): one a step squeezed, not one -/// dragged short. -pub fn squeezed(p: *Pardes, c: usize, before: *const [MAX_PANES]Rect, before_min: *const [MAX_PANES]u16) bool { - compute(p); - if (p.col_n[c] < 2) return false; - for (p.col_panes[c][0..p.col_n[c]]) |k| { - const pane = p.panes[k] orelse continue; - if (!pane.collapsed and p.rects[k].h < minRows(p, k) and before[k].h >= before_min[k]) return true; +/// Whether new column `c` (Newcol's, the finder's) may stay. A narrower +/// column wraps long tags onto more rows, which can leave a pane under its +/// tag and two rows: each pane a column squeezed so (one that had its +/// minimum `before`, `before_min`, not one dragged short) takes rows back +/// from the panes with rows to spare, its column shared out again only +/// where that is not enough. False, `c` dropped unannounced, where nothing +/// holds every minimum, as a size too small is refused. +pub fn keepColumn(p: *Pardes, c: usize, before: *const [MAX_PANES]Rect, before_min: *const [MAX_PANES]u16) bool { + restoreMinimaFrom(p, before, before_min); + for (0..p.ncol) |k| { + compute(p); + if (p.col_n[k] < 2) continue; + const squeezed = for (p.col_panes[k][0..p.col_n[k]]) |id| { + const pane = p.panes[id] orelse continue; + if (!pane.collapsed and p.rects[id].h < minRows(p, id) and before[id].h >= before_min[id]) break true; + } else false; + if (squeezed and !shareColumn(p, k)) { + dropColumnUnannounced(p, c); + return false; + } } - return false; + return true; } /// Column `c`'s rows for `id`, last in it, at its minimum: a row at a |
