diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 19:28:29 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 20:02:56 -0300 |
| commit | c40d447e63663d947f241d60a2bdb8ce1bd141c0 (patch) | |
| tree | 93dcd149384624306166f1a7a6b5d75b138ca27c /core/layout.zig | |
| parent | f26cf0be705280ff28ca69aaef6cc64e1466ed4e (diff) | |
| download | pardes-c40d447e63663d947f241d60a2bdb8ce1bd141c0.tar.gz pardes-c40d447e63663d947f241d60a2bdb8ce1bd141c0.zip | |
messages: one notice row at the window's foot indexes the live messages, and the chips over the bodies go (pick-ui SPEC §10.3, walk UI line C item 2): the panes' area ends a row higher (layout.noticeRowHeight, none on a screen under 3 rows, as the column tags); the row is a header layer of its own (Layer.Kind.notice_row, NOTICE_ROW_LAYER, Region.Kind.notice_row) in the workspace tag's colours: on the left the message the row leads with (error > question > warn > notice > echo, the newest within a rank: its glyph in its kind's ink, its cause unless its words name it, its words without a host's clock stamp, ×n, its places as words), dimmed once its bright time is over; on the right +N more, N questions · SPC e, SPC e walk for an error with places, or N messages · SPC h m; with nothing live the focused pane's path:line (a terminal's directory); built each frame from the state (Messages.noticeRow, bounded by notice_row_cap), the left part giving way to the right; B2 runs and B3 Looks at a word on it (mouse.zig); Pane.Notices keeps the leader's and a prompt's chips only; a latent fault found by it: a kind's pane reopened (its file changed on disk, a Restore) kept the hashes of the views its old state was told, so the new state was never told its view and a PDF stayed blank until something moved its pane; the reloaded message's chip used to move it (Kind.reopen now tells a new state every view; behaviour addons_pdf's disk-change and Restore tests, failing before the fix); a message's cause for a kind's pane is its path; every frame changes (the foot row): boot's foot reads '/tmp/pardes-snap/boot/cwd', msg's 'repainted' '· saved /tmp/pardes-snap/msg/cwd/a.txt 2 messages · SPC h m' where a chip stood on the body's first row; the 98 tty goldens rewritten and read (57 the rows shifted alone, the rest the chips gone and racy shell output re-recorded; no file-written block and no snapshot's name changed), the four tty cases that click at fixed rows given a row more (chordcut, layout-open, images, respawn: their cursors unchanged), the addon scripts' outputs (fake, snake, life, pdf: windows a row shorter, the chip gone), hxdiff's core a row taller (22 rows as helix's), the tests over tiny screens a row taller, the drag edge of a bottom pane over the notice row (mouse.zig); tests: Messages.zig 'the notice row leads with the most important live message ...', 'a builtin announces itself on the notice row, an echo ...', draw.zig 'the word under the pointer on the notice row is lit ...', 'a message wider than the notice row ... gives way to the row's right end'; tui gate: core-test, pane-test, shell-test, behaviour-test (and --replay: 20 seeds, 0 failures), term-test, kitty-test pass; process-test 0 of 146 failed; the gui build is gated at the line's end
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/layout.zig')
| -rw-r--r-- | core/layout.zig | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/core/layout.zig b/core/layout.zig index 7fa57ee9..ff14a789 100644 --- a/core/layout.zig +++ b/core/layout.zig @@ -613,7 +613,7 @@ pub fn minRows(p: *Pardes, id: usize) u16 { pub fn minimaFit(p: *Pardes) bool { const v = p.view(); compute(p); - const avail = v.screen_h -| (p.topBarHeight() + columnBarHeight(p)); + const avail = v.screen_h -| (p.topBarHeight() + columnBarHeight(p) + noticeRowHeight(p)); for (0..p.view().ncol) |c| { if (v.cols[c].n < 2) continue; var need: u32 = 0; @@ -647,7 +647,7 @@ pub fn shareColumn(p: *Pardes, c: usize) bool { compute(p); const n = v.cols[c].n; if (n == 0) return false; - const avail = v.screen_h -| (p.topBarHeight() + columnBarHeight(p)); + const avail = v.screen_h -| (p.topBarHeight() + columnBarHeight(p) + noticeRowHeight(p)); var mins: [MAX_PANES]u16 = undefined; var need: u32 = 0; for (v.cols[c].panes[0..n], 0..) |k, i| { @@ -1333,7 +1333,8 @@ pub fn expandedNeighbor(p: *const Pardes, col: usize, index: usize, side: enum { fn computeCollapsedColumn(p: *Pardes, c: usize, x: u16, width: u16, folded: usize) void { const v = p.view(); var y: u16 = p.topBarHeight() + columnBarHeight(p); - const available = v.screen_h -| y; + const bottom = v.screen_h -| noticeRowHeight(p); + const available = bottom -| y; var expanded_left: usize = 0; var weight: f32 = 0; for (v.cols[c].panes[0..p.view().cols[c].n]) |id| if (p.panes[id]) |pane| { @@ -1347,7 +1348,7 @@ fn computeCollapsedColumn(p: *Pardes, c: usize, x: u16, width: u16, folded: usiz var folded_left = folded; for (v.cols[c].panes[0..p.view().cols[c].n]) |id| { const pane = p.panes[id] orelse continue; - const room = v.screen_h -| y; + const room = bottom -| y; const height: u16 = if (pane.collapsed) blk: { folded_left -= 1; break :blk @min(room, BOX_H); @@ -1401,7 +1402,8 @@ pub fn compute(p: *Pardes) void { var y: u16 = p.topBarHeight() + columnBarHeight(p); const top = y; - const avail_h = v.screen_h -| y; + const bottom = v.screen_h -| noticeRowHeight(p); + const avail_h = bottom -| y; var hs: [MAX_PANES]u16 = undefined; const n = v.cols[c].n; for (0..n) |k| { @@ -1412,7 +1414,7 @@ pub fn compute(p: *Pardes) void { }; const lastk = k + 1 == n; const fh = @as(f32, @floatFromInt(avail_h)) * pane.vweight / vsum; - const room = v.screen_h -| y; + const room = bottom -| y; hs[k] = if (lastk) room else @min(room, @max(1, @as(u16, @intFromFloat(@round(fh))))); y +|= hs[k]; } @@ -1471,6 +1473,14 @@ pub fn topBarHeight(p: *const Pardes) u16 { return TOPBAR_H; } +/// The notice row's height: one row at the window's foot (pick-ui SPEC +/// §10.3), the index of the live messages, under every column; none on a +/// screen too short for it, as the column tags have none. +pub fn noticeRowHeight(p: *const Pardes) u16 { + if (p.view().screen_h < 3) return 0; + return 1; +} + /// The column tags' height: one row, as acme's (cols.c:244, colresize, /// gives a column tag one font height); a newline in one is a space /// (tagline.flattenHeaders). @@ -1668,14 +1678,14 @@ test "collapse transfers height upward and restores the original layout" { toggleCollapse(p, 1); try std.testing.expectEqual(@as(u16, 1), p.view().rects[1].h); try std.testing.expectEqual(@as(f32, @floatFromInt(original[1].h)), p.panes[1].?.vweight); - try std.testing.expectEqual(p.view().screen_h, p.view().rects[2].y + p.view().rects[2].h); + try std.testing.expectEqual(p.view().screen_h - noticeRowHeight(p), p.view().rects[2].y + p.view().rects[2].h); try std.testing.expect(p.view().rects[0].h > original[0].h); try std.testing.expectEqualDeep(original[2], p.view().rects[2]); toggleCollapse(p, 1); try std.testing.expectEqualDeep(original, p.view().rects); toggleCollapse(p, 2); try std.testing.expectEqual(@as(u16, 1), p.view().rects[2].h); - try std.testing.expectEqual(p.view().screen_h, p.view().rects[2].y + p.view().rects[2].h); + try std.testing.expectEqual(p.view().screen_h - noticeRowHeight(p), p.view().rects[2].y + p.view().rects[2].h); } test "collapse changes only one neighbor at the top middle and bottom" { @@ -1793,7 +1803,7 @@ test "collapse single and all panes leave unused column space" { try std.testing.expectEqual(p.view().rects[0].y + 1, p.view().rects[1].y); try std.testing.expect(p.view().rects[1].y + 1 < p.view().screen_h); toggleCollapse(p, 0); - try std.testing.expectEqual(p.view().screen_h - 1, p.view().rects[1].y); + try std.testing.expectEqual(p.view().screen_h - noticeRowHeight(p) - 1, p.view().rects[1].y); } test "collapse survives tiny resizes" { @@ -1854,7 +1864,7 @@ test "collapse dump restores folded state and retained expansion weight" { try std.testing.expectEqual(@as(f32, @floatFromInt(original_height)), restored.panes[0].?.vweight); try std.testing.expectEqual(@as(u16, 1), restored.view().rects[0].h); toggleCollapse(restored, 0); - try std.testing.expectEqual(restored.view().screen_h - restored.view().rects[0].y, restored.view().rects[0].h); + try std.testing.expectEqual(restored.view().screen_h - noticeRowHeight(restored) - restored.view().rects[0].y, restored.view().rects[0].h); } test "column reorder moves only crossed state and preserves weights" { |
