summaryrefslogtreecommitdiff
path: root/src/layout.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 03:39:43 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit84d23aef86c0bcb6ee14bb69b1e4d6d65205e2f6 (patch)
treef45ab1d07c16ceec51d8c164ad210aa220efe484 /src/layout.zig
parent98e94b86a7c38e2bf4d66e57144fc9329906bb3b (diff)
downloadpardes-84d23aef86c0bcb6ee14bb69b1e4d6d65205e2f6.tar.gz
pardes-84d23aef86c0bcb6ee14bb69b1e4d6d65205e2f6.zip
size says its limits, keeps every pane its rows, and ptys follow their panes
size refused an out-of-range line without saying the range, took a size too small for the panes (leaving bodies of no rows), and a terminal squeezed to its tag kept a pty of its old size. The refusal now names 20x6 to 4096x4096 (a bare size is EINVAL like any malformed line), a size that would leave any pane less than its tag and 2 rows is refused and undone, and a terminal's pty is resized with its pane down to one row (only a folded or unplaced one keeps its grid). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/layout.zig')
-rw-r--r--src/layout.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/layout.zig b/src/layout.zig
index 4c974fb7..bdef9675 100644
--- a/src/layout.zig
+++ b/src/layout.zig
@@ -433,6 +433,20 @@ pub fn placedRoomy(p: *Pardes, id: usize, before: *const [MAX_PANES]Rect) bool {
return true;
}
+/// Whether every unfolded pane sharing its column has its tag and
+/// `min_body_rows` (one alone in its column always fits).
+pub fn everyPaneRoomy(p: *Pardes) bool {
+ compute(p);
+ for (0..p.ncol) |c| {
+ if (p.col_n[c] < 2) continue;
+ 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)) return false;
+ }
+ }
+ return true;
+}
+
/// Places `id` in column `c` by halving its tallest unfolded pane, when
/// that leaves both their rows; false, and `id` in no column, when not.
pub fn splitTallest(p: *Pardes, c: usize, id: usize) bool {