From 60e85abe53debc0c8dd8986b748e9c86086e0007 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 26 Nov 2026 02:44:20 -0300 Subject: body_layer, Places, Query, Output, Tables, File, Prompt, Pick, Core: the body draws every colour from the chrome (the themes programme's L2b; DESIGN.md R7-R12, B5, B6, G7), worked out once a theme change by Chrome.of and read by `p.chrome()`, never by a theme's own fields or the old views: ONE SELECTION FAMILY (R7): the primary range, a `gw` label and a target with no number on `page.selection` in its ink, a multi-cursor head that selection reversed; every other range, a hover, a look preview, `m a`/`m i`'s region, a selecting prompt's dimmed preview and a query pane's current row on `selection_secondary` (the page halfway toward the selection in OKLab) in the text's own ink, where they were four sRGB mixes (25 % and 50 % toward a page that was `dark`'s tag) and a secondary drew `sel_fg`; the B1, B2 and B3 sweeps the chrome's `sweeps` (select, exec on the error hue, look on the added hue; acme its own), the body's and the tags' alike, where body_layer.buttonTints tinted the selection toward the keyword, string and number; HITS (R8, G7 as the designer's position): every place, a picker's landing line, a query pane's and a results pane's match on `hit` in the text's ink (was the theme's search ink), the current place and a landing line's matched span solid in the hue with the page's ink (`hit_current`, `hit_current_text`), where Roles drew a third tone step (1.9:1) that 68 themes could not show and a query pane its search ground; a search whose field is no regex dims its last places, the current on `hit` and the rest on `hit_faint` (new: the page halfway toward the hit, R7's secondary for hits; DESIGN.md is silent); SEVERITIES (R9): a message's words and detail after its line (Messages.inkOn, new: an error, a warning and a question their severity's ink on that ground, an echo, a notice and progress its dim ink), a diagnostics list's labels, a rename's struck name and its new one, each `page.severity`, where they were the theme's raw diagnostic inks or Roles' pushed ones; DIFF GROUNDS (R10): a patch's rows, changed words and faint lines (File.recolorSyntax), a pipe prompt's and a code action's ghost rows, `add` and `del` with the page's text, where colors.Grounds mixed the page 18 %, 28 % and 7 % toward the palette's green and red once a frame; THE REST: line numbers `line_number` and the caret's `line_number_current` (R12: derived where a theme has none, it was the plain number), the wrap marker the line numbers', a tree's guides (a call stack's) and their wrap pads the page's dim ink (were the info ink: a guide is meta, B5's dim row), a location the line numbers' ink, keys, `▸` and the sam fence `page.key`, context rows, a table's header and a hover's ghost lines on the plain tag's ground (its ink for the hover), a table's rules the page's rule ink (were `border orelse lineno`), the rail and thumb the chrome's, the body's page and text `page` (a theme that leaves its page to the host leaves it its text, as before), syntax `syntax`; DELETED: Core.bodyChrome and its cache (`body_chrome`: a whole Theme compared with meta.eql for every decorated row and every wrap-pad cell, C1's A7), body_layer.buttonTints and buttonInks, the Grounds recipe (colors.Grounds is the library's view on the chrome now: lib_syntax exports it, test/consumer pins its relations), Roles.hit and hit_current with hitOf and their floors, ChromeTheme's search_fg, diagnostic_info, diagnostic_hint and lineno (nothing reads them now); every value is Chrome.of's, worked out at a theme change (finishThemeInitialization, setThemeIndex, previewTheme, loadThemeFile), never a frame, a row or a cell: the one new one, `hit_faint`, is one OKLab mix there; RUN (TEST FIRST): Places.zig "places: each on the hit ground in its text's own ink, the current one solid ... the selection over it; a search whose field is no regex dims them, the rest faint" (orchard: after `/alpha`, Enter and `j`, the current place `hit_current` in `hit_current_text`, the other `hit` in the page's text; searched again, its current under the selection; with `(` the others `hit_faint`): fails on the base at its current place (Roles' 1.9:1 step under the text's ink, where the hue in the page's ink is asked; its first version, asked during the live prompt, failed there on #3c614a: the body's selection is the current place then, drawn over it as before); Query.zig "a query pane's hits are the body's ..." (a `/alpha` query pane: the row's match `hit` in the text's ink, the owner's current place solid, the current row `selection_secondary` between its places and to its end, none below): fails on the base at Query.zig (expected #917a53, found #5e4923, the search ground); body_layer.zig "the body's selections are one family (R7) ..." (`eC` in orchard: the primary on `page.selection` in its ink, the other range on `selection_secondary` in the text's ink, its head reversed, a B2 sweep held over beta on `sweeps[1]`): fails on the base at body_layer.zig (expected #24382c, found #243a2d); body_layer.zig "the body's surfaces take every colour from the chrome: none reads a theme's own fields or the old views (DESIGN.md B6)" (the source test: body_layer, Places, Query, Output, Tables, File, Prompt, Pick, jj and ansi, their code before their tests: `theme()` read for its name alone, no chromeTheme(), bodyChrome, .roles, Grounds or LegacyTheme); re-pinned to the chrome and failing on the base: Prompt.zig's pipe ghosts (del.row #331a12, was Grounds' #302b25) and `/`'s `▸` (page.key #add38a, was Roles' #bada9d), Pick.zig's code action ghosts and its landing line, body_layer's motion targets, the build error's `✗` in `page.severity[0]`; colors.zig "line numbers stay quiet ..." (a ThemeFile with no current number: R12's derived one, 4.5:1), look.zig's hover preview on `selection_secondary`, test/output.zig and test/panes.zig's results colours (hit, page text, line numbers, the warning severity); GOLDENS re-recorded (13, orchard unless said), each class read: (1) R8 hit ink: a match on #5e4923 (orchard's own search ground, kept as its `hit`) in the text #e5eee5 where its search ink #f7e4a5 was: callstack 6 cells, psearch 15, stepgrain 26, lsprelpath 11; (2) G7 current hit: lsprelpath row 20, the owner's current place in a query row, #0d1410 on #917a53 (the hue held 4.5:1) where it was #f7e4a5 on #5e4923, 9 cells; (3) R7 secondary: #243a2d (sRGB half) to #24382c (OKLab half), the text's own ink where `sel_fg` #f5f7ee was: multicursor 2 cells and selregex 24 (secondary ranges), stepgrain 285 and lsprelpath 185 (a query pane's current row); (4) R10 diff grounds: diffview rows 12-19 (the diff pane's own rows: added #263025 to #132503, deleted #302b25 to #331a12, 558 cells; the same values the command pane's diff took in L2c), diffstack rows 26-29 (a faint added line #171f18 to #101c0b, changed words #364131 to #203900 and #453832 to #53251b), pagercolor rows 36-37 (a +Pager's faint lines: #1a1d18 to #211812, #171f18 to #101c0b); markers and syntax inks unchanged; (5) a tree's guides: callstack rows 11-21, #92d1de (the info ink) to #666f68 (the page's dim ink), 35 cells; (6) key ink: fsearch's `▸`, #bada9d (pushed over seven tag grounds) to #add38a (the accent held on the page); (7) R7 exec sweep: headersweep and headersweep-restored, a B2 sweep on the header, #f5f7ee on #5b7e5a (the selection tinted toward the string) to #e5eee5 on #4c251b (the error hue a selection step off the page), 8 and 16 cells (draw.zig's sweeps, moved with buttonTints); (8) R12: themesel row 26, the caret line's number in solarized_dark (#586e75 to #7f9193) and acme (#999980 to #74746a), themes with no current-line number of their own; no text moved, no other golden; GATES: core-test 1132/1305 (173 skipped; the merge's 1128/1301 + 4), shell-test 1353/1356 (3 skipped), pane-test 184/185 (1 skipped), behaviour-test 280/280 and --replay 20 seeds of 70 steps, 0 failures, process-test 0 of 147 failed (3 skipped; 13 re-recorded above, ttyhelp unmoved), term-test 17/17, kitty-test 45/45; gui unit-test 1957/1961 (4 skipped; its one failure the known BaselineHarnessMismatch; test/consumer's Grounds relations pass on the chrome's rows); PICTURES (the S kit, 26 px, 100x30, `Jumps walk`; before = install74's pardes-gui, after = this tree's Debug gui): .scratch/themes/L2b/png/, `--before|after.png` and `pair--.png` side by side, in dark, neonotte84, orchard and acme: `search` (a live `/words`: the current place is the body's selection, as before), `landed` (Enter, then `j`: the current place the solid chip), `selhit` (`x` over a hit), `grep` (SPC f g count: the preview's landing line and matched span), `error` (`:zig build`'s error words after report.zig's line 11: dark's were its grey text, red now), `diff` (a .diff file's rows); the dump and the digest unchanged (`body_chrome` was derived, `theme_chrome` local), so no fuzz or soak; load 3.2 to 9.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- core/Places.zig | 59 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 11 deletions(-) (limited to 'core/Places.zig') diff --git a/core/Places.zig b/core/Places.zig index 8563d7c8..63f9ced6 100644 --- a/core/Places.zig +++ b/core/Places.zig @@ -659,19 +659,17 @@ pub fn origin(set: *const Places, pane: *Pane) usize { } /// Every place on the rows shown, tinted over the text: the hit ground, -/// the current one the current hit's (colors.Roles, UX D4, D14). +/// the current one solid in the hue with the page's ink (R8, UX D14); a +/// search prompt's pattern that is no regex, its last places dimmed: the +/// current on the hit ground, the rest faint. pub fn paint(set: *Places, p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, body_h: u16) void { if (!set.shows(pane)) return; const f = &pane.file.?; - const th = p.theme(); - const roles = &p.chromeTheme().roles; - var strong = roles.hit_current; - var quiet = roles.hit; - // A search prompt's pattern that is no regex: its last places, dimmed. - if (pardes.Prompt.dims(p, pane)) { - strong = quiet; - quiet = colors.mix(th.bg orelse th.tag_bg, quiet); - } + const c = p.chrome(); + const dim = pardes.Prompt.dims(p, pane); + const strong = if (dim) c.hit else c.hit_current; + const strong_ink: ?[3]u8 = if (dim) null else c.hit_current_text; + const quiet = if (dim) c.hit_faint else c.hit; const hits = set.hits.items; if (hits.len == 0) return; const nlines = File.nlines(p.gpa, f); @@ -697,7 +695,7 @@ pub fn paint(set: *Places, p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, const b = @min(hits[i].end, le) - ls; if (b <= a) continue; const current = set.current != null and set.current.? == i; - File.paintWordSelection(p, s, pane, r, line, @intCast(a), @intCast(b), if (current) strong else quiet); + File.paintWordSelection(p, s, pane, r, line, @intCast(a), @intCast(b), if (current) strong else quiet, if (current) strong_ink else null); } } } @@ -903,3 +901,42 @@ test "a session's places loaded from its dump find what an edit makes as the ses b.panes[b.view().active].?.file.?.mtime = a.panes[a.view().active].?.file.?.mtime; try std.testing.expectEqual(pardes.walk.digest(Pardes, a), pardes.walk.digest(Pardes, b)); } + +test "places: each on the hit ground in its text's own ink, the current one solid, the hue its ground and the page its ink (R8, G7), the selection over it; a search whose field is no regex dims them, the rest faint" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer p.deinit(); + colors.setThemeIndex(p, colors.themeIndex("orchard").?); + const pane = try p.setTestFile("alpha beta\ngamma alpha\nb\nb\nb\nb\nb\nb\nb\nzeta alpha\n"); + // Landed on the first, the caret then moved off it: the places stay. + typeKeys(p, "/alpha"); + p.update(.{ .key = .{ .cp = pardes.Key.enter } }); + typeKeys(p, "j"); + try std.testing.expect(pane.places.shows(pane)); + try std.testing.expectEqual(@as(?usize, 0), pane.places.current); + const c = p.chrome(); + var frame: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer frame.deinit(); + const r = p.view().rects[0]; + const x = r.x + pardes.config.GUTTER + File.gutterWidth(pane); + const y = p.bodyTop(pane, r); + var s = try p.render(frame.allocator()); + for (0..5) |i| { + const current = s.at(x + @as(u16, @intCast(i)), y).style; + try std.testing.expectEqual(pardes.Color{ .rgb = c.hit_current }, current.bg); + try std.testing.expectEqual(pardes.Color{ .rgb = c.hit_current_text }, current.fg); + const other = s.at(x + 6 + @as(u16, @intCast(i)), y + 1).style; + try std.testing.expectEqual(pardes.Color{ .rgb = c.hit }, other.bg); + try std.testing.expectEqual(pardes.Color{ .rgb = c.page.text }, other.fg); + } + // Searched again from line 2: its place current and selected, the + // selection over the hit; then `(`, no regex: the others faint (line + // 10's: the prompt's words lie over the top rows). + typeKeys(p, "/alpha"); + try std.testing.expectEqual(@as(?usize, 1), pane.places.current); + s = try p.render(frame.allocator()); + for (0..4) |i| try std.testing.expectEqual(pardes.Color{ .rgb = c.page.selection.ground }, s.at(x + 6 + @as(u16, @intCast(i)), y + 1).style.bg); + typeKeys(p, "("); + try std.testing.expect(pardes.Prompt.dims(p, pane)); + s = try p.render(frame.allocator()); + for (5..10) |i| try std.testing.expectEqual(pardes.Color{ .rgb = c.hit_faint }, s.at(x + @as(u16, @intCast(i)), y + 9).style.bg); +} -- cgit v1.3 From a4629d033cb11489371fe4dd987e9da48bd46690 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 26 Nov 2026 04:46:20 -0300 Subject: body_layer: a selection that is the current place is drawn as the current place, its solid chip, not the selection (the coordinator's ruling on L2b's open point; DESIGN.md G7, B1.2: one meaning, one look): THE CAUSE: a live `/`, `n` and a picker's preview each select the current place (Places.settle takes the current one from a selection equal to it, and the walk lands a selection on it), and the body drew the primary selection over every place after Places.paint, so G7's solid current-hit chip showed only once the caret moved off it (L2b's report: "its current under the selection"); THE FIX: where the primary selection is exactly the current place (the same bytes, the places shown), the body leaves its tint off and the place's chip stands; the caret still shows (the tty's cursor, a preview's head cell), and a selection anywhere else, or grown past the place, is the selection as before; one comparison a frame a pane (the primary range against the current place), no new state; RUN (TEST FIRST): body_layer.zig "a selection that is the current place is drawn as the current place, its solid chip, not the selection ..." (orchard: a live `/alpha`, the first place's five cells `hit_current` in `hit_current_text`; Enter and `n`, the second's the same and the cursor on it; `x`, the line selected past it, the selection's ground): fails on L7 at body_layer.zig:1497 (expected #917a53, the chip; found #3c614a, the selection), passes now; Places.zig's "places: each on the hit ground ..." re-pinned where it asked L2b's open point ("searched again from line 2: its place current and selected, the selection over the hit": the chip now); core-test 1143/1316 (173 skipped: L7's 1142/1315 + this test); OUTSIDE my files: core/body_layer.zig (the rule and its test), core/Places.zig (one assertion of L2b's test); the goldens it moves are read with the rest at the end gate Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- core/Places.zig | 8 ++++---- core/body_layer.zig | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) (limited to 'core/Places.zig') diff --git a/core/Places.zig b/core/Places.zig index 63f9ced6..b4ef17aa 100644 --- a/core/Places.zig +++ b/core/Places.zig @@ -928,13 +928,13 @@ test "places: each on the hit ground in its text's own ink, the current one soli try std.testing.expectEqual(pardes.Color{ .rgb = c.hit }, other.bg); try std.testing.expectEqual(pardes.Color{ .rgb = c.page.text }, other.fg); } - // Searched again from line 2: its place current and selected, the - // selection over the hit; then `(`, no regex: the others faint (line - // 10's: the prompt's words lie over the top rows). + // Searched again from line 2: its place current and selected, drawn as + // the place (body_layer: one meaning, one look); then `(`, no regex: the + // others faint (line 10's: the prompt's words lie over the top rows). typeKeys(p, "/alpha"); try std.testing.expectEqual(@as(?usize, 1), pane.places.current); s = try p.render(frame.allocator()); - for (0..4) |i| try std.testing.expectEqual(pardes.Color{ .rgb = c.page.selection.ground }, s.at(x + 6 + @as(u16, @intCast(i)), y + 1).style.bg); + for (0..4) |i| try std.testing.expectEqual(pardes.Color{ .rgb = c.hit_current }, s.at(x + 6 + @as(u16, @intCast(i)), y + 1).style.bg); typeKeys(p, "("); try std.testing.expect(pardes.Prompt.dims(p, pane)); s = try p.render(frame.allocator()); diff --git a/core/body_layer.zig b/core/body_layer.zig index 1eb3bf54..a1d76784 100644 --- a/core/body_layer.zig +++ b/core/body_layer.zig @@ -373,6 +373,17 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane const show_prim = (pane.body.mode == .normal and pane.body.vsel.active) or preview or (modal_hover and pane.body.vsel.active); const show_extra = pane.body.mode != .tty and pane.body.nsel > 0; + // The primary selection that is the current place (a live `/`, `n`, a + // preview select it) is drawn as that place, its solid chip, not the + // selection: one meaning, one look; the caret still shows. + const on_place = place: { + const f = pane.file orelse break :place false; + const at = pane.places.current orelse break :place false; + if (!pane.places.shows(pane) or at >= pane.places.hits.items.len) break :place false; + const range = pane.body.primaryRange(f.content, 0); + const hit = pane.places.hits.items[at]; + break :place hit.start == @min(range.anchor, range.head) and hit.end == @max(range.anchor, range.head); + }; if (show_prim or show_extra) { const vpfx: i32 = if (pane.file != null) panes.File.gutterWidth(pane) else 0; var si: usize = 0; @@ -394,6 +405,7 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane const bg = if (full) c.page.selection.ground else c.selection_secondary; var vr: i32 = 0; while (vr + @as(i32, pane.tag_rows) < @as(i32, body_bottom)) : (vr += 1) { + if (primary and on_place) break; const w = pane.wrapAt(p.settings.tab, vr); if (w.line < bnd.lo_row or w.line > bnd.hi_row) continue; const visible_line = modal.lineSlice(body, @intCast(vr)); @@ -1471,3 +1483,42 @@ test "the body's surfaces take every colour from the chrome: none reads a theme' } try std.testing.expectEqual(@as(usize, 0), wrong); } + +test "a selection that is the current place is drawn as the current place, its solid chip, not the selection: one meaning, one look (the coordinator's ruling on L2b's open point); the caret still shows, and any other selection is the selection" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); + defer p.deinit(); + colors.setThemeIndex(p, colors.themeIndex("orchard").?); + const pane = try p.setTestFile("alpha beta\ngamma alpha\nb\n"); + const c = p.chrome(); + var frame: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer frame.deinit(); + const r = p.view().rects[0]; + const x = r.x + config.GUTTER + panes.File.gutterWidth(pane); + const y = p.bodyTop(pane, r); + const keys = struct { + fn typed(q: *Pardes, text: []const u8) void { + for (text) |ch| q.update(.{ .key = .{ .cp = ch, .text = &[_]u8{ch} } }); + } + }.typed; + // A live `/`: the first place current, and selected. + keys(p, "/alpha"); + try std.testing.expectEqual(@as(?usize, 0), pane.places.current); + var s = try p.render(frame.allocator()); + for (0..5) |i| { + const cell = s.at(x + @as(u16, @intCast(i)), y).style; + try std.testing.expectEqual(Color{ .rgb = c.hit_current }, cell.bg); + try std.testing.expectEqual(Color{ .rgb = c.hit_current_text }, cell.fg); + } + // Landed, then `n`: the next one current and selected, the same chip, + // and the caret on it. + p.update(.{ .key = .{ .cp = pardes.Key.enter } }); + keys(p, "n"); + try std.testing.expectEqual(@as(?usize, 1), pane.places.current); + s = try p.render(frame.allocator()); + for (6..11) |i| try std.testing.expectEqual(Color{ .rgb = c.hit_current }, s.at(x + @as(u16, @intCast(i)), y + 1).style.bg); + try std.testing.expect(s.cursor != null and s.cursor.?.y == y + 1 and s.cursor.?.x >= x + 6 and s.cursor.?.x <= x + 10); + // The line selected, past the place: a selection again. + keys(p, "x"); + s = try p.render(frame.allocator()); + try std.testing.expectEqual(Color{ .rgb = c.page.selection.ground }, s.at(x + 6, y + 1).style.bg); +} -- cgit v1.3