diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 03:18:54 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 03:50:26 -0300 |
| commit | 744c4519dc812f2b2a10769965384981249a9c4c (patch) | |
| tree | 3a8002f3a7a6a7438ae700b1be446c7c150ad07e /dev | |
| parent | bdbe524d8ea6b08689b2eec77d2a2db316ae32d2 (diff) | |
| download | pardes-744c4519dc812f2b2a10769965384981249a9c4c.tar.gz pardes-744c4519dc812f2b2a10769965384981249a9c4c.zip | |
gui: a reading pane's tag is its reading tint in a window too, round its button, inside its ring and in the underlay between its rows, and the layer-cover test meets the notice row (walk UI M4 item 3; G2's gui unit-test failures under the walk default: 1872/1878 here, those two failed, nothing else): RUN: "every pixel of a grip column is band, button or ring, and the button sits over the scrollbar" failed at gui.zig TestButtonUnderFirstRow: its pane is a test file never edited, so where jumps walk (the default since G's pumvrovu) it READS and the core paints its tag's ground the reading tint (draw.zig tagGround: chrome.tag_reading_bg, "its focus is its grip's"); the test held the column to the focused tag's or the tag's colour; made to hold it to the tag's ground, it then met what the window draws itself: gripDecor's band round the button (`grip.active ? tag_focus_bg : tag_bg`), the unfocused ring's inside (gripFill: tag_bg) and the tagline cells' underlay (emitSurfaceCell's band_base: `here.focus ? tag_focus_bg : tag_bg`, the gutters between rows a smaller tagline font leaves), none of which knew a pane reads: a window showed every reading pane's tag (most file panes, by default) with slivers of the focused or plain tag colour round its button and stripes of it between its tag rows; THE FIX: Region.reading (surface.zig, set by draw.zig on a pane's grip and tag regions: Trail.reading) and Chrome.tag_reading_bg carry it to the window; Cover.reading (coverFrame, from the grip and tag regions) picks the underlay, gripDecor's band and gripFill's ring inside take the reading tint for a reading pane (a focused ring keeps its fill, a dirty one its colour); the frames of a session whose jumps are new-pane (the frame gate's corpus) are unchanged (no pane reads); "the layer cover is the per-cell layer scan, over a core's layouts and random layers" failed at its `notices` check: line C's messages are said on the notice row (the window's foot, a tag layer of kind `notice_row`), no longer as a chip over a body (a `notice` layer is now only a pane's own prompt band: Del's question, a REPL's choice; E's prompts are in the tag), so its `Msg` made no `notice` layer in any of its 32 frames; DECIDED: it covers the notice row (some frame's tag layers hold a `notice_row` layer with rows, scanned by the cover as every other layer), its `Msg` said so; a pane's notice band keeps draw.zig's own test (core-test); TEST: both fail before (gui.zig:7232, gui.zig:7127), pass now (the grip test holds every pixel of the column, the button's row too, to the reading tint, the button, the rings and the rules); gui unit-test 1874/1878 (4 skipped, none failed; its perf step the known BaselineHarnessMismatch)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/gui/gui.zig | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index 923db181..6cd97b69 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -689,7 +689,10 @@ const Cover = packed struct(u16) { grip_top: bool = false, /// In an unfocused pane's tag or body rows while InactiveDim fades them. dim: bool = false, - _: u3 = 0, + /// In a reading pane's grip or tag rows (Region.reading): their + /// underlay is the reading tint. + reading: bool = false, + _: u2 = 0, }; /// Marks the grid cells a body or tag layer covers, which the layers paint @@ -730,10 +733,14 @@ fn coverFrame(cover: []Cover, cols: u16, rows: u16, body_layers: []const pardes. for (0..@min(region.rect.w, 16)) |offset| mark.rect(cover, cols, rows, .{ .x = region.rect.x +| @as(u16, @intCast(offset)), .y = region.rect.y, .w = 1, .h = region.rect.h }, "grip_offset", @as(u4, @intCast(offset))); if (region.kind == .grip and region.active) mark.rect(cover, cols, rows, region.rect, "focus", true); if (region.dirty) mark.rect(cover, cols, rows, region.rect, "dirty", true); + if (region.reading) mark.rect(cover, cols, rows, region.rect, "reading", true); if (region.kind == .grip) mark.rect(cover, cols, rows, region.rect, "pane_grip", true); mark.rect(cover, cols, rows, .{ .x = region.rect.x, .y = region.rect.y, .w = region.rect.w, .h = @min(1, region.rect.h) }, "grip_top", true); }, - .tag => if (region.active) mark.rect(cover, cols, rows, region.rect, "focus", true), + .tag => { + if (region.active) mark.rect(cover, cols, rows, region.rect, "focus", true); + if (region.reading) mark.rect(cover, cols, rows, region.rect, "reading", true); + }, .column => { mark.rect(cover, cols, rows, .{ .x = region.rect.x, .y = 0, .w = 1, .h = rows }, "anchor", true); if (region.active) if (bar) |b| mark.rect(cover, cols, rows, .{ .x = region.rect.x, .y = b.y, .w = region.rect.w, .h = b.h }, "focus", true); @@ -4300,9 +4307,11 @@ fn gripButton(g: *const Gui, chrome: *const pardes.Chrome, col: u16, row: u16, l /// A pane's button fill, from its region's state, not the grid's cells /// (which are drawn for cell shells): dirty, focused, or the tag's ground. -fn gripFill(chrome: *const pardes.Chrome, focus: bool, dirty: bool) [3]u8 { +fn gripFill(chrome: *const pardes.Chrome, focus: bool, dirty: bool, reading: bool) [3]u8 { if (dirty) return chrome.grip_dirty; - return if (focus) chrome.grip_focus_ring else chrome.tag_bg; + if (focus) return chrome.grip_focus_ring; + // The ring's inside is the tag's ground: a reading pane's tint. + return if (reading) chrome.tag_reading_bg else chrome.tag_bg; } fn inkOn(bg: [3]u8) [3]u8 { @@ -4367,9 +4376,9 @@ fn emitSurfaceCell( if (role == .tagline) { const here = line_cover[at]; // The workspace row's underlay is its own ground (a theme's status - // bar), else the focused or plain tag's. + // bar), else a reading pane's tint, the focused or the plain tag's. const band_base: pardes.Cell = .{ - .style = .{ .bg = .{ .rgb = if (row < chrome.tagline_rows) chrome.tagline_bg else if (here.focus) chrome.tag_focus_bg else chrome.tag_bg }, .font_role = .tagline }, + .style = .{ .bg = .{ .rgb = if (row < chrome.tagline_rows) chrome.tagline_bg else if (here.reading) chrome.tag_reading_bg else if (here.focus) chrome.tag_focus_bg else chrome.tag_bg }, .font_role = .tagline }, .default = false, }; // The smaller font changes the ink, not the chrome's coverage. Painting @@ -4410,7 +4419,7 @@ fn emitSurfaceCell( const center = (b[0] + b[2]) / 2 - @as(f32, @floatFromInt(col - offset)) * body_layout.w; const shift: f32 = if (cached != null) @as(f32, @floatFromInt(@as(u32, offset) * g.cell_w)) + @as(f32, @floatFromInt(config.GUTTER * g.cell_w)) / 2 - center else 0; const resolved = resolveCell(g, glyph[0..1], 0, null, .tagline, false, page); - const ink = if (here.pane_grip) inkOn(gripFill(chrome, here.focus, here.dirty)) else resolved.fg; + const ink = if (here.pane_grip) inkOn(gripFill(chrome, here.focus, here.dirty, here.reading)) else resolved.fg; instances[next.*].fr = @as(f32, @floatFromInt(ink[0])) / 255; instances[next.*].fg = @as(f32, @floatFromInt(ink[1])) / 255; instances[next.*].fb = @as(f32, @floatFromInt(ink[2])) / 255; @@ -4427,7 +4436,7 @@ fn emitSurfaceCell( const base = &instances[next.* - 1]; const own: [3]f32 = .{ instances[next.*].br, instances[next.*].bg, instances[next.*].bb }; if (here.pane_grip) { - const fill = gripFill(chrome, here.focus, here.dirty); + const fill = gripFill(chrome, here.focus, here.dirty, here.reading); base.br = @as(f32, @floatFromInt(fill[0])) / 255; base.bg = @as(f32, @floatFromInt(fill[1])) / 255; base.bb = @as(f32, @floatFromInt(fill[2])) / 255; @@ -5309,7 +5318,7 @@ fn gripDecor(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, ce const button = gripButton(g, chrome, grip.rect.x, grip.rect.y, layout); // Round the button, its first row is the tag's band: nothing of the // cells under it shows there. - const band = if (grip.active) chrome.tag_focus_bg else chrome.tag_bg; + const band = if (grip.reading) chrome.tag_reading_bg else if (grip.active) chrome.tag_focus_bg else chrome.tag_bg; const left = @as(f32, @floatFromInt(grip.rect.x)) * layout.w; const right = @as(f32, @floatFromInt(grip.rect.x + grip.rect.w)) * layout.w; try addDecor(g, gpa, left, button[1], button[0], button[3], band, 1, win_w, win_h); @@ -5362,7 +5371,7 @@ fn gripDecor(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, ce if (x >= cols) continue; const cell = &cells[@as(usize, y) * cols + x]; if (cell.default or cell.printableAscii() != ' ') continue; - const rgb = inkOn(gripFill(chrome, grip.active, grip.dirty)); + const rgb = inkOn(gripFill(chrome, grip.active, grip.dirty, grip.reading)); const center_x = @floor((button[0] + button[2]) / 2); const center_y = @as(f32, @floatFromInt(y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(y, win_h, g.cell_h, g.tagline_height))) + @as(f32, @floatFromInt(g.tagline_height)) / 2; const half_w = @max(dp(1), @min(dp(3), @floor((button[2] - button[0] - 2 * dp(3)) / 2))); @@ -7089,7 +7098,8 @@ test "a block cursor's cell is drawn reversed: the cell's ink its ground, its gr test "the layer cover is the per-cell layer scan, over a core's layouts and random layers" { // A gui-shaped core: its tagline is narrower and shorter than the body, - // so tags and notices are layers. + // so tags and the notice row (the live messages' index at the window's + // foot, Messages.noticeRow) are layers. const core = try pardes.Pardes.init(std.testing.allocator, .{ .cols = 97, .rows = 31 }); defer core.deinit(); core.update(.{ .resize = .{ .cols = 97, .rows = 31, .row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 7, .tagline_h = 13 } } }); @@ -7098,12 +7108,12 @@ test "the layer cover is the per-cell layer scan, over a core's layouts and rand pardes.layout.insert(core, 1, 1, 2); pardes.layout.insert(core, 0, 1, 3); var cover: [97 * 31]Cover = undefined; - var notices = false; + var notice_row = false; for (0..32) |step| { if (step & 3 == 0) try std.testing.expect(core.executeBuiltinLine(2, "Collapse")); core.view().prefix = if (step & 4 != 0) .leader else .none; if (step & 8 != 0) { - try std.testing.expect(core.executeBuiltinLine(0, "Msg a message chip over the body")); + try std.testing.expect(core.executeBuiltinLine(0, "Msg a message on the notice row")); try std.testing.expect(core.executeBuiltinLine(3, "Msg another")); } const s = try core.render(core.scratch.allocator()); @@ -7122,9 +7132,9 @@ test "the layer cover is the per-cell layer scan, over a core's layouts and rand try std.testing.expectEqual(region.owner == core.view().active, cell.focus); } } - for (s.tagLayers()) |layer| notices = notices or (layer.rows != 0 and layer.kind == .notice); + for (s.tagLayers()) |layer| notice_row = notice_row or (layer.rows != 0 and layer.kind == .notice_row); } - try std.testing.expect(notices); + try std.testing.expect(notice_row); // Random layers: overlapping, empty, past the grid's right and bottom // edges, and at the top of u16, where x + w overflows it. @@ -7217,10 +7227,13 @@ test "every pixel of a grip column is band, button or ring, and the button sits } }.of; const chrome = &s.chrome; - const band = if (focus == 0) chrome.tag_focus_bg else chrome.tag_bg; + // The tag's ground (draw.zig tagGround): a reading pane's tint where + // jumps walk (the pane's file never edited), else the focused tag's + // or the tag's; round the button and under it alike. + const band = if (pardes.Trail.reading(core, core.panes[0].?)) chrome.tag_reading_bg else if (focus == 0) chrome.tag_focus_bg else chrome.tag_bg; // Band, fills, rings, the rules between stacked panes and under the // tag, and the mode marks' ink (the grip's first cell's). - const ink = inkOn(gripFill(chrome, grip.active, grip.dirty)); + const ink = inkOn(gripFill(chrome, grip.active, grip.dirty, grip.reading)); const allowed = [_][3]f32{ rgb(band), rgb(core.chromeTheme().box), rgb(pardes.draw.boxDirty(core)), rgb(chrome.grip_border), rgb(chrome.grip_focus_ring), rgb(chrome.border), rgb(ink), rgb(chrome.tag_rule orelse mixRgb(chrome.tag_bg, chrome.page orelse bg_default)) }; for (pixels, 0..) |pixel, n| { const got = pixel orelse return error.TestUnpaintedGripPixel; |
