diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 10:13:26 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 10:13:27 -0300 |
| commit | 0e3b4aa74a5969a3b8b298e9ffa3205399c9afdd (patch) | |
| tree | 0216fa23fdf186271e4690d9c517e583b1be7c74 /core/layout.zig | |
| parent | 6d90badbf94dcee1c8a123153fb331b8c523c9f1 (diff) | |
| download | pardes-0e3b4aa74a5969a3b8b298e9ffa3205399c9afdd.tar.gz pardes-0e3b4aa74a5969a3b8b298e9ffa3205399c9afdd.zip | |
Core, layout, draw: the band starts on the row under the head's last, in the rows the tag keeps from rest, and no spine hangs where no band row is (UX D5 as E3 amends it, DESIGN.md E5.2: "there is never a blank row between a head and its rows"; "no stub `│` in a kept row under a prompt"): a pane whose tag takes two rows at rest showed `SPC ?`'s one-row head, a blank row with spines, then the band (P1-L 03/04, P2-L 02/03); TESTS FIRST: Band.zig "a narrow band gives way ... the band starts on the row under the head, in the rows the tag keeps from rest" (44 columns, a tag of 2 rows at rest, Help for SPC l: on the base the tag's own rows 2 (`expected 1, found 2`), the band from its third row) and "out of rest with no band, the rows a tag keeps from rest stay blank: a spine hangs only where a band row is" (`/` in the same pane: on the base a `│` under the key cell in the kept row); THE CHANGE: Core.sync lays a host's tag out as the head's own rows (a terminal's: the rows at rest, as before), and a band of B rows takes the rows kept from rest first: `band_rows = max(B, kept - head)`, `tag_rows = max(kept, head + band_rows)` (body offset = max(rest rows, head rows + band rows), E3), so the band (drawn from `tag_rows - band_rows`, draw.joinBand, and read there by mouse.zig) starts under the head and its ground runs down through the kept rows; with no band the tag keeps its rows from rest, blank: draw.paintPaneTag's spines in the kept rows (P1's reading 6, E4: "no band no spine") are deleted; layout.floorRows works the band's pane's top out from the state as sync will lay it, `max(rows at rest, head rows + band)` (layout.headRows: the prefix out of rest and the head, wrapped as sync wraps them), where it read the last sync's rows (`tag_rows - band_rows + band`): the first layout after a head changed (a level's band opening) read the rows of the one before, and the next key would have moved the body by the kept rows; so that it can wrap at the pane's width, layout.compute gives each pane its column's x and width before it works out the heights (no rect had one while the floors were asked); the views.zig soak test now holds its band short under a picker's head and act row (2 rows: Find in the pane itself at 40x12: band 2 of 3, tag rows 4; the old load's `min(takes, tag_rows - 1)` would say 3): under SPC's one-row head the kept row is the band's now, and a head of one row never told the two apart; TagState's "a tag out of rest keeps its rows at rest at least" asks the new geometry (the head's own row, the body giving only what the band takes past the kept rows); GOLDEN: fsearch `nomatch`: the `│` under `/` in the kept row 17 is gone (a prompt with no band); no other golden moved; a band over a terminal or a kind's pane still starts under the rows the tag keeps (their tag is their rest rows, the pty and the view never resized); core-test 1086/1257 (171 skipped), process-test 1 of 147 failed before the golden (fsearch, regenerated)
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.zig | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/core/layout.zig b/core/layout.zig index 5550ef4a..2a5d2cf3 100644 --- a/core/layout.zig +++ b/core/layout.zig @@ -600,6 +600,22 @@ pub fn wantedTagRows(p: *Pardes, id: usize) u16 { return @intCast(@max(BOX_H, @min(shown.rows(), MAX_TAG_ROWS))); } +/// The rows pane `id`'s tag's text takes now: out of rest its head +/// (TagState) after what of its prefix stays (UX D1), wrapped at its width +/// as Pardes.sync wraps it; at rest what wantedTagRows says. +fn headRows(p: *Pardes, id: usize) u16 { + const pane = p.panes[id] orelse return BOX_H; + if (pane.collapsed or !pane.tag_expanded) return BOX_H; + var wrap_room: [Pane.prefix_room]u8 = undefined; + var wrap_fba = std.heap.FixedBufferAllocator.init(&wrap_room); + const wa = wrap_fba.allocator(); + const prefix = tagline.prefixIn(p, wa, pane) catch return pane.tag_rows; + const tail = tagline.shownTail(p, wa, pane) catch return pane.tag_rows; + const whole = std.mem.concat(wa, u8, &.{ prefix, tail }) catch return pane.tag_rows; + const shown = tagline.wrapTag(p.settings.tab, wa, whole, tagline.tagWidth(p, id)) catch return pane.tag_rows; + return @intCast(@max(BOX_H, @min(shown.rows(), MAX_TAG_ROWS))); +} + /// The rows a placement, and a `size`, leave a pane: its tag at its width /// and `min_body_rows`. The one minimum both ask. pub fn minRows(p: *Pardes, id: usize) u16 { @@ -1436,6 +1452,9 @@ pub fn compute(p: *Pardes) void { var vsum: f32 = 0; for (0..p.view().cols[c].n) |k| { if (p.panes[v.cols[c].panes[k]]) |pane| vsum += pane.vweight; + // Its width before its height: a band's floor wraps its tag at + // it (floorRows). + v.rects[v.cols[c].panes[k]] = .{ .x = x, .w = cw }; } if (vsum <= 0) vsum = 1; @@ -1478,7 +1497,12 @@ fn floorRows(p: *Pardes, id: usize) u16 { const pane = p.panes[id] orelse return 0; const band = if (pardes.Band.over(pane)) 0 else pardes.Band.takes(p, id); if (band > 0) { - const above = @max(1, pane.tag_rows -| pane.band_rows) + band; + // Over its body as Pardes.sync lays it out (UX E3): the head's rows + // and the band under them, or the rows the tag keeps from rest + // where those are more; worked out from the state, never the last + // sync's rows (the first layout after a head changed read the + // rows of the one before, and the next moved the body). + const above = @max(wantedTagRows(p, id), headRows(p, id) + band); // A body of 60 % is one and a half times what is above it. return above + @max(pardes.Band.body_rows, (3 * above + 1) / 2); } |
