diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-26 09:57:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-26 11:19:58 -0300 |
| commit | 44a04dc0eaa1697cee42219a2aa814352c63fbe6 (patch) | |
| tree | ee9f5269278926655f74429c1687ba1a64f95bac /core/draw.zig | |
| parent | 6b2b63f654561ba9d64c134e6ccc6c0784e15220 (diff) | |
| download | pardes-44a04dc0eaa1697cee42219a2aa814352c63fbe6.tar.gz pardes-44a04dc0eaa1697cee42219a2aa814352c63fbe6.zip | |
draw, colors: the band (a picker's rows, a level, a prompt's list, Help, the registers) drawn from the chrome on its tag's ground, focused or not, whatever its mode (DESIGN.md B6, G1'), and its cursor row on that ground's selection, a ground of its own (B1.3): its text, dim, rule, kind mark and name tint the tag ground's (`chrome.on(g)`, `name[g]`), the cursor row's text and dim the selection's, its keys, `▶` and matched letters the selection's own key and match inks (`Selection.key`, `Selection.match`, new, the accent and the hits' hue held 4.5:1 on that selection at a theme change; the ground's key and match stay held on the ground alone, D4's goldens for neonotte84 and acme unmoved); THE CAUSE where it was wrong: the band read the old view's Roles, whose key and match were pushed toward white or black over all seven tag and selection grounds at once (A5.7's joint floor: one ink for every ground) and whose reading grounds were the reading tint, so after the tag above it moved to the chrome's focus ground the band under a reading pane sat on the old tint; THE FIX: joinBand reads `p.chrome()` alone, and `Roles`, `RoleInks`, `TagGround`, `inksOn`, `toward`, `pushAway`, `matchHue` and `selectionOf` are deleted (nothing reads them: the tags, the grips, the notice row and the message inks moved in the change before), with ChromeTheme's `roles`; the ring test checks each ground's selection key and match (4.5:1 where its ground reaches it) and every grip fill's message marks (4.5:1 where the hue reaches it on the fill and, at rest and reading, the plain tag); its old copy of those checks, "every theme's walk UI roles meet their floors ...", goes with Roles (the ring's per-ground `inks` check holds the same floors on the chrome); RUN (TEST FIRST): Band.zig "a band is drawn in the theme's roles ..." re-pinned (the cursor row's `▶`, chord and matched letters in the selection's key and match, the spines in the focused tag's rule: on the base its reading pane's band was on the reading tint's Roles), Band.zig's register dim, Pick.zig's two band tests and bindings.zig's registers on the focused tag's inks; GOLDENS: none moved (no process golden captures a band's style); GATES (tui): core-test 1154/1328 (174 skipped: the Roles test gone), process-test 0 of 103 failed with --update (0 re-recorded); the ring 245 of 245; load 5.9 to 6.5; OUTSIDE draw.zig: core/colors.zig (Selection.key/match, groundInks, Roles deleted, the ring's two checks), core/Band.zig, core/Pick.zig, core/bindings.zig (tests)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/draw.zig')
| -rw-r--r-- | core/draw.zig | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/core/draw.zig b/core/draw.zig index 3d4c47b6..822bfb67 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -919,17 +919,15 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R const rows = drawn.band; if (r.w <= TAG_TEXT_INSET) return; const band = (try pardes.Band.of(p, arena, pane, id)) orelse return; - const chrome = p.chromeTheme(); + const chrome = p.chrome(); const tab = p.settings.tab; const columns = @max(band.columns, 1); - // The walk UI's inks on this tag's ground (colors.Roles, UX DESIGN.md - // D4), and on its cursor row's selection. - const ground: colors.TagGround = if (pardes.Trail.reading(p, pane)) (if (active) .reading_focused else .reading) else if (active) .focused else .plain; - const inks = chrome.roles.on(ground); - const selected = chrome.roles.selectedOn(ground); - // A symbol's kind mark (colors.Chrome.Inks.kind): held on this tag's - // ground and on its cursor row's selection. - const kind = p.chrome().on(if (active) .focus else .plain).kind; + // The inks of its tag's ground, focused or not, whatever its mode + // (DESIGN.md B6, G1'), and of its cursor row's selection, a ground of + // its own (B1.3). + const g: colors.Chrome.Ground = if (active) .focus else .plain; + const inks = chrome.on(g); + const selected = &inks.selection; const bg = inks.ground; const fg = inks.text; const storage = try arena.alloc(Cell, @as(usize, columns) * rows); @@ -948,17 +946,21 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R const next = modal.nextGrapheme(ln.text, at); const glyph = ln.text[at..next]; if (std.mem.eql(u8, glyph, "│")) t.at(col, row).style.fg = .{ .rgb = inks.rule }; - if (std.mem.eql(u8, glyph, "▶") or std.mem.eql(u8, glyph, "•")) t.at(col, row).style.fg = .{ .rgb = chrome.roles.key }; + if (std.mem.eql(u8, glyph, "▶") or std.mem.eql(u8, glyph, "•")) t.at(col, row).style.fg = .{ .rgb = inks.key }; at = next; } for (ln.parts) |part| { const end = @min(columns, part.col + part.width); - const on = if (part.row.on) selected else inks; + const dim = if (part.row.on) selected.dim else inks.dim; + const key = if (part.row.on) selected.key else inks.key; // The cursor's row across its step's width, its lead too (UX // D5), the lead's `▶` keeping the key ink (D4). if (part.row.on and part.col < end) { const lead = part.col -| 2; t.tint(lead, row, part.col - lead, selected.ground, null); + for (lead..part.col) |x| if (std.meta.eql(t.at(@intCast(x), row).style.fg, Color{ .rgb = inks.key })) { + t.at(@intCast(x), row).style.fg = .{ .rgb = selected.key }; + }; t.tint(part.col, row, end - part.col, selected.ground, selected.text); } var c = part.col; @@ -967,16 +969,16 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R const next = modal.nextGrapheme(part.row.text, b); const style = &t.at(c, row).style; if (b < part.row.key) { - style.fg = .{ .rgb = chrome.roles.key }; + style.fg = .{ .rgb = key }; style.bold = true; } // A chord (Help's `SPC h t`): keys, at the text's weight. - if (b < part.row.chord) style.fg = .{ .rgb = chrome.roles.key }; - if (b < part.row.pre) style.fg = .{ .rgb = if (active) chrome.tag_active_name_fg else chrome.tag_name_fg }; - if (part.row.dim or (b >= part.row.pre and b < part.row.pre + part.row.faint) or (b >= part.row.quiet[0] and b < part.row.quiet[1])) style.fg = .{ .rgb = on.dim }; - if (b < part.row.kind) style.fg = .{ .rgb = kind }; + if (b < part.row.chord) style.fg = .{ .rgb = key }; + if (b < part.row.pre) style.fg = .{ .rgb = chrome.name[@intFromEnum(g)] }; + if (part.row.dim or (b >= part.row.pre and b < part.row.pre + part.row.faint) or (b >= part.row.quiet[0] and b < part.row.quiet[1])) style.fg = .{ .rgb = dim }; + if (b < part.row.kind) style.fg = .{ .rgb = inks.kind }; for (part.row.keys) |k| if (k == b) { - style.fg = .{ .rgb = chrome.roles.key }; + style.fg = .{ .rgb = key }; style.bold = true; }; if (part.row.under) style.ul = .single; @@ -984,7 +986,7 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R // ground (never a ground of its own: on the cursor row's // selection one vanished). for (part.row.marks) |m| if (m == b) { - style.fg = .{ .rgb = chrome.roles.match }; + style.fg = .{ .rgb = if (part.row.on) selected.match else inks.match }; style.bold = true; }; b = next; @@ -992,7 +994,7 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R // Its meta, right-aligned in the part (Band.line), dim. if (pardes.Band.metaShown(tab, part.row, part.width) and part.col + part.width <= columns) { const meta: u16 = @intCast(panes.File.displayWidth(tab, part.row.meta)); - for (part.col + part.width - meta..part.col + part.width) |x| t.at(@intCast(x), row).style.fg = .{ .rgb = on.dim }; + for (part.col + part.width - meta..part.col + part.width) |x| t.at(@intCast(x), row).style.fg = .{ .rgb = dim }; } } } |
