From f930d53c58187381b2f0df6892546ac1c217c9db Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 22:27:44 -0300 Subject: settings #1, Tagbottom goes, a pane's tag at its head the one value anyone used: layout.bodyTop and tagTop, mouse's seam and clampBorderRow, applyRowSplit, body_layer's copy and the tests' row arithmetic lose their other arm (reads deleted in Core.zig, layout.zig, mouse.zig, draw.zig, gui.zig, macos.zig, whose ABI slot 11 says 0 now, and ninep/events.zig, ninep/tree.zig, look.zig, Messages.zig), with the registry row, SPC t b, Help, /commands, the builtins JSON and the reference row; deleted: the snapshot scripts tagbottom, tagbottomshort and tagbottomimage with their goldens, the behaviour test "placement: under Tagbottom a look from a pane's text goes under its text too", the window scene 10-tagbottom with its gui-goldens line and the macOS parity check tags-bottom; tests that ran both ends of the tag run the head; a dump that kept the field loads without it; perf.zig's harness id moves in the two debug baselines (its reads of the field went); the window scenes after 10-tagbottom (12 to 15, 17) take new gui-goldens lines, the two Tagbottom writes gone from the scene and with them their words on the message row (the base window build running the same scenes gives the same frames); gates on tui: core-test 966/966, behaviour-test 243/243, unit-test 1484/1485, pane-test 171/172, snap all 105 scripts ok, process-test 0 of 37 failed; gui unit-test 1529/1530, gui-golden 0 of 1 failed Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/layout.zig | 52 +++++++++++++++++++++------------------------------- 1 file changed, 21 insertions(+), 31 deletions(-) (limited to 'src/layout.zig') diff --git a/src/layout.zig b/src/layout.zig index 10bed438..38841f59 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -407,7 +407,7 @@ pub fn applyRowSplit(p: *Pardes, cc: usize, k: usize, cur_y: u16) void { const ra = p.rects[p.cols[cc].panes[k]]; const rb = p.rects[p.cols[cc].panes[k + 1]]; const combined: f32 = @floatFromInt(ra.h + rb.h); - var nt: f32 = @floatFromInt(if (p.settings.tag_bottom) cur_y -| ra.y else (cur_y + 1) -| ra.y); + var nt: f32 = @floatFromInt((cur_y + 1) -| ra.y); // A terminal keeps its tag and two body rows (floorRows); a text pane // gives up all but its tag, as acme's do. const lo: f32 = @floatFromInt(@max(BOX_H, floorRows(p, p.cols[cc].panes[k]))); @@ -828,9 +828,7 @@ fn splitAt(p: *Pardes, c: usize, id: usize, y: u16) void { } /// A pane's top plus its tag's rows, as heights go: a split this far down -/// leaves the pane its tag and that much of its body, whichever end the tag -/// is on (Tagbottom's is at its foot, the height the same; behaviour test -/// "placement: under Tagbottom..."). +/// leaves the pane its tag and that much of its body. fn bodyFrom(p: *const Pardes, id: usize) u16 { return p.rects[id].y + p.panes[id].?.tag_rows; } @@ -1429,7 +1427,6 @@ test "collapse local transfers remain bounded through repeated tiny window resiz } for (0..180) |step| { p.screen_h = @intCast((step * 17) % 81); - p.settings.tag_bottom = step % 3 == 0; compute(p); toggleCollapse(p, step % 5); var used: u16 = 0; @@ -1484,7 +1481,7 @@ test "collapse single and all panes leave unused column space" { try std.testing.expectEqual(p.screen_h - 1, p.rects[1].y); } -test "collapse survives tiny resizes and TagBottom" { +test "collapse survives tiny resizes" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 32 }); defer p.deinit(); _ = try p.newShell(1, ""); @@ -1492,22 +1489,17 @@ test "collapse survives tiny resizes and TagBottom" { insert(p, 0, 1, 1); insert(p, 0, 2, 2); p.panes[1].?.collapsed = true; - for ([_]bool{ false, true }) |bottom| { - p.settings.tag_bottom = bottom; - { - for (0..50) |height| { - p.screen_h = @intCast(height); - compute(p); - var used: u16 = 0; - for (p.cols[0].panes[0..p.cols[0].n]) |id| { - const rect = p.rects[id]; - try std.testing.expect(rect.h <= p.screen_h -| rect.y); - used += rect.h; - } - try std.testing.expect(used <= p.screen_h); - if (height >= 5) try std.testing.expectEqual(@as(u16, 1), p.rects[1].h); - } + for (0..50) |height| { + p.screen_h = @intCast(height); + compute(p); + var used: u16 = 0; + for (p.cols[0].panes[0..p.cols[0].n]) |id| { + const rect = p.rects[id]; + try std.testing.expect(rect.h <= p.screen_h -| rect.y); + used += rect.h; } + try std.testing.expect(used <= p.screen_h); + if (height >= 5) try std.testing.expectEqual(@as(u16, 1), p.rects[1].h); } p.screen_h = 32; compute(p); @@ -1525,8 +1517,7 @@ test "collapse can be expanded by dragging its boundary" { try std.testing.expect(!p.panes[0].?.collapsed); try std.testing.expectEqual(@as(u16, 6), p.rects[0].h); toggleCollapse(p, 1); - p.settings.tag_bottom = true; - applyRowSplit(p, 0, 0, p.rects[1].y - 5); + applyRowSplit(p, 0, 0, p.rects[1].y - 6); compute(p); try std.testing.expect(!p.panes[1].?.collapsed); try std.testing.expectEqual(@as(u16, 6), p.rects[1].h); @@ -1849,16 +1840,15 @@ pub fn wantedTagRows(p: *Pardes, id: usize) u16 { return @intCast(@max(BOX_H, @min(shown.rows(), MAX_TAG_ROWS))); } -/// The pane's first body row: under the tag when it is on top, over it -/// when it is at the bottom. Notice bands do NOT move it -- they are an -/// overlay, drawn over the top rows rather than taking them. -pub fn bodyTop(p: *const Pardes, pane: *const Pane, r: Rect) u16 { - return if (p.settings.tag_bottom) r.y else r.y + pane.tag_rows; +/// The pane's first body row, under its tag. Notice bands do NOT move it +/// -- they are an overlay, drawn over the top rows rather than taking them. +pub fn bodyTop(_: *const Pardes, pane: *const Pane, r: Rect) u16 { + return r.y + pane.tag_rows; } -/// The tag's first row: the pane's top, or its last rows with Tagbottom. -pub fn tagTop(p: *const Pardes, pane: *const Pane, r: Rect) u16 { - return if (p.settings.tag_bottom) r.y + r.h -| pane.tag_rows else r.y; +/// The tag's first row: the pane's top. +pub fn tagTop(_: *const Pardes, _: *const Pane, r: Rect) u16 { + return r.y; } pub fn tagCapacity(p: *const Pardes, physical_width: u16) u16 { -- cgit v1.3