summaryrefslogtreecommitdiff
path: root/core/layout.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 12:38:27 -0300
committerGabriel Schneider <[email protected]>2026-11-25 12:50:44 -0300
commite6c384833912598d65c509f0d3a7b713fab0a8eb (patch)
tree8392991253b366e4152df327528ba1c4f8af005f /core/layout.zig
parent46f004ba04ad6d6299c8967d6890b8f7110db88a (diff)
parent7e4d1d727487455376c54695bb13683b9d1e5cc9 (diff)
downloadpardes-e6c384833912598d65c509f0d3a7b713fab0a8eb.tar.gz
pardes-e6c384833912598d65c509f0d3a7b713fab0a8eb.zip
walk UI M9: X3's seed 109/162 fix (wkylslmo 7e4d1d727487, one change on X2's suvlqwul: a walk step never refuses and never takes a row its column cannot give: a walked reading pane's tag at rest folds to its newest step, then cuts its path from the left, `…` and the basename whole, worked out each time from the pane's own rect by tagline.folded (Fold{whole, cut, squeezed}), restPath writing the cut name; Trail.lift takes a row at a time from the column (layout.giveRow) while the column has one; draw.zig tagTintRange/paintPaneTag and Prompt.unlit take `.whole`; the tree.zig placement test runs under the walk default, 300 seeds) merged onto M8 (tspqtroz), resolved by meaning: no text conflict (X3's tagline, Trail, layout.giveRow and its one-line hunks in draw.zig and Prompt.zig sit beside X1's and X2's); THE ORDER X3 ASKED TO CHECK: X1 (E5.2) gives each pane of a column its width before its height in layout.compute, so that a band host's floor (floorRows: max(wantedTagRows, headRows + band)) wraps its tag at the width it will have; compute starts from zeroed rects, so in that pass a pane has `w` and `h == 0`; X3's folded reads both: on X3's own tree `w == 0` there returned before any cut (and wantedTagRows returned the last sync's rows); on the merge `h == 0` read as a pane with no rows, so a walked reading pane hosting a band had its path cut to its basename in the floor while the sync after it, with the real height, kept it whole: the floor counted fewer rows above the body than the tag took; RUN (TEST FIRST): Trail.zig "a band on a walked reading pane keeps it a body of 60 % ..." (40 columns, the reader's path some 230 cells, its tag at rest 6 rows or more; its share of the column swept from 12 rows to 30, Help with a query nothing matches, a 4-row band): fails on the merge at Trail.zig:1019, the body under 60 % of the pane (UX D6, E3); a user could have hit it on a walked reading pane with a long path in a narrow column, any band (a level, Help, a picker) opened on it; THE FIX (tagline.folded): `r.h == 0` reads as not laid out, as `r.w == 0` does: no cut, the tag at rest whole; the floor then reserves the whole tag and the sync, given at least that many rows, finds it fits: both count the same rows; where the column cannot give them, the sync cuts as X3 does; the witnesses X3 named pass: tree.zig "random placements, refused or not ..." (shell-test, filtered 8/8) and P1's Pick "after Enter the list is a word in the reader's trail ..." (core-test, filtered 11/11); core-test 1097/1268 (171 skipped: M8's 1095 + X3's test + this one), process-test 0 of 147 failed (3 skipped): no golden moved
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/layout.zig')
-rw-r--r--core/layout.zig31
1 files changed, 30 insertions, 1 deletions
diff --git a/core/layout.zig b/core/layout.zig
index 9c15833d..4b5b7d2c 100644
--- a/core/layout.zig
+++ b/core/layout.zig
@@ -586,7 +586,9 @@ pub fn acmePlace(p: *Pardes, c: usize, origin: ?usize, id: usize) void {
pub const min_body_rows = 2;
/// The rows pane `id`'s tag takes at its width, wrapped as `sync` wraps
-/// it: what a placement must leave it above its body rows.
+/// it: what a placement must leave it above its body rows. A walked file's
+/// path is cut to the rows its pane has (tagline.folded): its tag never
+/// wants a row more.
pub fn wantedTagRows(p: *Pardes, id: usize) u16 {
const pane = p.panes[id] orelse return BOX_H;
if (pane.collapsed or !pane.tag_expanded) return BOX_H;
@@ -744,6 +746,33 @@ pub fn restoreMinimaFrom(p: *Pardes, before: *const [MAX_PANES]Rect, before_min:
compute(p);
}
+/// One row more for pane `id` from whichever pane of its column has the
+/// most above its own minimum, as restoreMinimaFrom gives them; false,
+/// changing nothing, when none has one (or the column holds a folded
+/// pane).
+pub fn giveRow(p: *Pardes, id: usize) bool {
+ const v = p.view();
+ compute(p);
+ const c = (findPane(p, id) orelse return false).col;
+ const col = v.cols[c].panes[0..v.cols[c].n];
+ var giver: ?usize = null;
+ var spare: u16 = 0;
+ for (col) |k| {
+ const pane = p.panes[k] orelse return false;
+ if (pane.collapsed) return false;
+ if (k != id and v.rects[k].h -| minRows(p, k) > spare) {
+ spare = v.rects[k].h - minRows(p, k);
+ giver = k;
+ }
+ }
+ const g = giver orelse return false;
+ for (col) |k| p.panes[k].?.vweight = @floatFromInt(@max(1, v.rects[k].h));
+ p.panes[g].?.vweight -= 1;
+ p.panes[id].?.vweight += 1;
+ compute(p);
+ return true;
+}
+
/// Column `c`'s rows for `id`, last in it, at its minimum: a row at a
/// time from whichever pane has the most above its own minimum, so a pane
/// dragged short keeps its rows and the others give only what they must.