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/draw.zig | 97 ++++++++++++++++++++++++++++-------------------------------- 1 file changed, 45 insertions(+), 52 deletions(-) (limited to 'src/draw.zig') diff --git a/src/draw.zig b/src/draw.zig index ac13fc7d..ce5f86c1 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1040,27 +1040,24 @@ test "a tag of three rows has its grip on the first, and band under it that stil pane.tag.own = try std.testing.allocator.dupe(u8, "Second\nthird\nfourth"); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - for ([_]bool{ false, true }) |bottom| { - p.settings.tag_bottom = bottom; - p.sync(); - _ = arena.reset(.retain_capacity); - const s = try p.render(arena.allocator()); - const r = p.rects[0]; - const top = p.tagTop(pane, r); - try std.testing.expect(pane.tag_rows >= 3); - const chrome = p.chromeTheme(); - const band = if (p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg; - for (0..config.GUTTER) |dx| { - const x = r.x + @as(u16, @intCast(dx)); - try std.testing.expectEqual(Color{ .rgb = chrome.box }, s.at(x, top).style.bg); - for (1..pane.tag_rows) |line| { - const cell = s.at(x, top + @as(u16, @intCast(line))); - try std.testing.expectEqual(Color{ .rgb = band }, cell.style.bg); - try std.testing.expectEqualStrings(" ", cell.grapheme()); - } + p.sync(); + _ = arena.reset(.retain_capacity); + const s = try p.render(arena.allocator()); + const r = p.rects[0]; + const top = p.tagTop(pane, r); + try std.testing.expect(pane.tag_rows >= 3); + const chrome = p.chromeTheme(); + const band = if (p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg; + for (0..config.GUTTER) |dx| { + const x = r.x + @as(u16, @intCast(dx)); + try std.testing.expectEqual(Color{ .rgb = chrome.box }, s.at(x, top).style.bg); + for (1..pane.tag_rows) |line| { + const cell = s.at(x, top + @as(u16, @intCast(line))); + try std.testing.expectEqual(Color{ .rgb = band }, cell.style.bg); + try std.testing.expectEqualStrings(" ", cell.grapheme()); } - try std.testing.expectEqual(pane.tag_rows, s.region(.grip, 0).?.rect.h); } + try std.testing.expectEqual(pane.tag_rows, s.region(.grip, 0).?.rect.h); } test "place puts every part where the painters and layers put it, in every layout" { @@ -1074,7 +1071,6 @@ test "place puts every part where the painters and layers put it, in every layou var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); for (0..16) |step| { - p.settings.tag_bottom = step & 1 != 0; if (step & 4 != 0) try std.testing.expect(p.executeBuiltinLine(p.active, "Msg a placed notice")); if (step == 8) try std.testing.expect(p.executeBuiltinLine(1, "Collapse")); if (step == 12) try std.testing.expect(p.executeBuiltinLine(1, "Collapse")); @@ -1214,7 +1210,7 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", std.mem.asBytes(&@as([20][5]u8, @splat("long-".*))), " " }; - const commands = [_][]const u8{ "New", "Newcol", "Collapse", "Tagbottom", "TreeContext", "Wrap", "Find", "Del", "FocusTint", "Debug" }; + const commands = [_][]const u8{ "New", "Newcol", "Collapse", "TreeContext", "Wrap", "Find", "Del", "Debug" }; var text: std.ArrayListUnmanaged(u8) = .empty; defer text.deinit(std.testing.allocator); for (0..steps) |_| { @@ -1318,38 +1314,35 @@ test "a body with context rows is painted once, and the grid's rows are what a p pane.file.?.scroll = 8; var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - for ([_]bool{ false, true }) |bottom| { - p.settings.tag_bottom = bottom; - // A selection and the cursor on body rows, painted in the one pass. - pane.body.cur_row = 12; - pane.body.cur_col = 3; - pane.body.vsel = .{ .active = true, .row = 10, .col = 2 }; - pane.body.mode = .normal; - p.sync(); - _ = arena.reset(.retain_capacity); - const s = try p.render(arena.allocator()); - const layer = &s.body_layers[0]; - try std.testing.expect(layer.context_rows > 0); - const body = s.region(.body, 0).?; - // The plain paint the grid used to take, of the same frame. - const cells = try arena.allocator().alloc(Cell, s.cells.len); - @memset(cells, .{}); - var plain: Surface = .{ .cols = s.cols, .rows = s.rows, .cells = cells }; - pane.view.layered = false; - try body_layer.renderBody(p, &plain, arena.allocator(), pane, p.rects[0], 0, true, null); - pane.view.layered = true; - for (0..body.rect.h) |row| { - const y = body.rect.y + row; - for (0..body.rect.w) |col| { - const x = body.rect.x + col; - const got = s.cells[y * s.cols + x]; - const want = plain.cells[y * s.cols + x]; - try std.testing.expect(got.visuallyEqual(&want)); - } + // A selection and the cursor on body rows, painted in the one pass. + pane.body.cur_row = 12; + pane.body.cur_col = 3; + pane.body.vsel = .{ .active = true, .row = 10, .col = 2 }; + pane.body.mode = .normal; + p.sync(); + _ = arena.reset(.retain_capacity); + const s = try p.render(arena.allocator()); + const layer = &s.body_layers[0]; + try std.testing.expect(layer.context_rows > 0); + const body = s.region(.body, 0).?; + // The plain paint the grid used to take, of the same frame. + const cells = try arena.allocator().alloc(Cell, s.cells.len); + @memset(cells, .{}); + var plain: Surface = .{ .cols = s.cols, .rows = s.rows, .cells = cells }; + pane.view.layered = false; + try body_layer.renderBody(p, &plain, arena.allocator(), pane, p.rects[0], 0, true, null); + pane.view.layered = true; + for (0..body.rect.h) |row| { + const y = body.rect.y + row; + for (0..body.rect.w) |col| { + const x = body.rect.x + col; + const got = s.cells[y * s.cols + x]; + const want = plain.cells[y * s.cols + x]; + try std.testing.expect(got.visuallyEqual(&want)); } - try std.testing.expectEqual(plain.cursor, s.cursor); - // The layer's own rows run past the grid's. - try std.testing.expect(layer.rows > body.rect.h); } + try std.testing.expectEqual(plain.cursor, s.cursor); + // The layer's own rows run past the grid's. + try std.testing.expect(layer.rows > body.rect.h); } -- cgit v1.3