summaryrefslogtreecommitdiff
path: root/core/layout.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-26 12:44:35 -0300
committerGabriel Schneider <[email protected]>2026-11-26 13:02:49 -0300
commit51f211d694beff9a389ab519f2286cef077adb81 (patch)
tree2df93ee551f2820011f6f67b32f5131fbd927888 /core/layout.zig
parent3d60aa05ec1a6f9ed535186be6c6c2850c71b24d (diff)
parentd7b01dfc187244b6613a954d82552675d3bd2689 (diff)
downloadpardes-51f211d694beff9a389ab519f2286cef077adb81.tar.gz
pardes-51f211d694beff9a389ab519f2286cef077adb81.zip
merge (M3): tonplrtr 3d60aa05ec1a (L2a: the tags, grips, band and notice row drawn from the chrome, the old ChromeTheme, Roles and Grounds views deleted, part H's inks, the path dim while a pane previews another file; M2's wxvzvomn, dump.load resolves the chrome; FP's PDF preview leak, the exec rerun's spawn stop, ABI 3.4's PDF hits) with rppqvrqx d7b01dfc1872 (W9, walkui UX DESIGN part O on W5's part M: the tag stays at rest and the head hangs under it as the band's first row, a picker hangs under the tag of the pane with the keyboard, the mouse never ends it, TagState.waits, Pick.tall, the act/source row gone), resolved: THE CODE: core/draw.zig joinBand draws W5/W9's layout with L2a's inks: the head (TagState.head) and the band from `p.chrome().on(focus or plain)` (its keys `inks.key`, its error `inks.severity[0]`, its dim and rule the ground's), the band's rows' keys, chords, `pre` (the name tint `chrome.name[g]`), dim, kind and matched letters as L2a drew them, W9's loop variable `i` kept; paintPaneTag keeps W9's question in the tag (TagState.asking) and L2a's single tag ink (W9's out-of-rest `text_style` gone with L2a's: a question's text and the tag's own were the same ink once Roles went), and draws the computed words in the words' ink whenever the tag does not ask (L2a's `head == null and !asks`: out of rest the tag is the rest tag now, so its words are the rest words); render's head-and-band gutter (W9's `at.tag`) on L2a's ground; draw's key-ink test reads `p.chrome().on(.focus)` and W9's `? help`; core/TagState.zig's W5 test "out of rest a tag is drawn as at rest ..." (renamed: "... but the box and its path's ink, the path its own and dim ...") lets the path's cells differ in their ink alone, the dim ink, the dimmed text ending `/far.txt`: L2a's zrxurkop dims a tag's path while its body previews another file (the coordinator's ruling, UX DESIGN M7.2), which the test, written before it on W5's tree, read as a moved cell (core-test failed it at TagState.zig:1741 on the merge as jj made it); THE GOLDENS: process-test -- --update re-recorded all 103 golden cases, the 102 golden files (every one with a frame out of rest among them), and moved exactly the two in conflict, fsearch and selregex, each now W9's text rows byte for byte (gdiff.py: no snap row differs from W9's) and L2a's inks on them; read cell by cell (.scratch/walkui/M3/gpairs.py: each cell where the merge differs from W9's recording, and whether L2a made that same move base -> L2a): selregex's four style blocks and fsearch's one move only by L2a's classes: the window and column rows to the page (#b2c3b8 on #1d2824 -> #788079 on #0d1410, the active column's #becfc4 on #314738 too), the reading pane's tint #2c2c0f gone to the focus ground #394440 under the rest tag (full ink #becfc4 -> #cadbd0, the name tint #ecc8f2 kept, its computed words and the blanks after them #becfc4 -> #a1b1a8, the word ink) and under the head on the row below it (text #cadbd0, keys #bada9d -> #add38a bold, dim #79836f -> #8e9d94), a focused reading grip's glyph #000000 -> mode_glyph #06779d, the rail's current tick to the current hit #917a53, a command pane's computed words #b2c3b8 -> #819188; the only pairs L2a's own recordings never made are the same ink moves on cells W9 newly drew there: the head row's gutter cells on the tag's ground (`d` and the body's #e5eee5 on #2c2c0f -> #394440: render's gutter fill on L2a's ground), and fsearch's rest tag on the reading pane W9 moved to row 16 (name tint and words as selregex's); no row neither side explains; the 100 other golden files re-recorded byte for byte as the merge had them (L2a's 36 as L2a recorded them, W9's six text-only goldens as W9 did); GATES (Debug tui, on this change): core-test 1163/1338 (175 skipped; L2a's tree 1160/1335, W9's three new tests), shell-test 1386/1389 (3 skipped), process-test 0 of 103 failed with --update (2 moved, read above); the rest of the gates on the stack's top; load 1.2 to 2.5
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.zig47
1 files changed, 24 insertions, 23 deletions
diff --git a/core/layout.zig b/core/layout.zig
index c8fb91f9..b15c7200 100644
--- a/core/layout.zig
+++ b/core/layout.zig
@@ -592,7 +592,7 @@ pub const min_body_rows = 2;
/// wants a row more.
pub fn wantedTagRows(p: *Pardes, id: usize) u16 {
const pane = p.panes[id] orelse return BOX_H;
- return tagRows(p, id, tagline.computedWords(pane));
+ return tagRows(p, id, tagline.tagWords(p, pane));
}
/// The rows pane `id`'s tag at rest takes with computed words `words`.
@@ -609,20 +609,19 @@ fn tagRows(p: *Pardes, id: usize, words: []const u8) 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.
+/// The rows pane `id`'s head takes under its tag out of rest (TagState,
+/// UX DESIGN M2), wrapped at the tag's width as the band draws it; none at
+/// rest.
pub 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;
+ const pane = p.panes[id] orelse return 0;
+ if (pane.collapsed) return 0;
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)));
+ // A head with no room to be made in is a row still.
+ const head = (pardes.TagState.head(p, wa, pane) catch return 1) orelse return 0;
+ const shown = tagline.wrapTag(p.settings.tab, wa, head.text, tagline.tagWidth(p, id)) catch return 1;
+ return @intCast(@min(shown.rows(), MAX_TAG_ROWS));
}
/// The rows a placement, and a `size`, leave a pane: its tag at its width
@@ -1608,23 +1607,25 @@ pub fn compute(p: *Pardes) void {
/// The fewest rows a pane is laid out with: a terminal keeps its tag and
/// `min_body_rows` (a shorter one loses its prompt and reads busy for
/// ever), a text pane may shrink to its tag, as acme's windows do. A tag
-/// out of rest has the rows for its head and its band, drawn over its body
-/// (UX DESIGN I1); a picker's (code actions' too: its body is the preview)
-/// a body of 60 % of the pane and 6 rows at least under them (UX D6). Those
-/// are borrowed from the column's other panes, which shrink to their tags
-/// until it rolls up (walk UI SPEC §3.6). A terminal's and a kind's size
-/// is their user's: a transient state never resizes the pty under a
-/// program or a kind's view (a PDF's), it is drawn over as much of them as
-/// it has (R3).
+/// out of rest has the rows for its head and its band under it, drawn over
+/// its body (UX DESIGN I1, M4). The pane a picker's preview shows in (code
+/// actions' asking pane too: its body is the preview) has a body of 60 % of
+/// the pane and 6 rows at least under its tag, and its head and band when
+/// it asked (UX D6, DESIGN O1). Those are borrowed from the column's other
+/// panes, which shrink to their tags until it rolls up (walk UI SPEC
+/// §3.6). A terminal's and a kind's size is their user's: a transient
+/// state never resizes the pty under a program or a kind's view (a PDF's),
+/// it is drawn over as much of them as it has (R3).
fn floorRows(p: *Pardes, id: usize) u16 {
const pane = p.panes[id] orelse return 0;
- const band = if (pane.isTerminal() or pane.addon != null) 0 else pardes.Band.takes(p, id);
- if (band > 0) {
+ const under = if (pane.isTerminal() or pane.addon != null) 0 else headRows(p, id) + pardes.Band.takes(p, id);
+ const preview = pardes.Pick.previewPane(p, id);
+ if (under > 0 or preview) {
// 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);
- if (p.view().tag_state.kind != .pick) return above;
+ const above = wantedTagRows(p, id) + under;
+ if (!preview) return above;
// 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);
}