From 3ace8b385e02a54830decb6aa48d1fa28d076a18 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 26 Nov 2026 00:04:32 -0300 Subject: Trail, Pick, Prompt, Jump: Ctrl-o pops the walk one word at a time (UX DESIGN L'1, binding; the user: "I did spc f f then did /something but I didn't know how to get back to the previous one", "the pickers are kinda shown as a stack right? I felt like I could pop the current one"): the trail's words, left to right, are the stack, and Ctrl-o steps one word left of where the pane is, Ctrl-i one right; onto a place as before (Trail.go); onto a list's word, that kept picker unrolls again in this pane's tag as it was left (query, cursor, marks), previewing here (Pick.reopen with `walking`, its step): Esc gives rest exactly as before the Ctrl-o, Enter lands as that word's (a step from it, the steps after it dropped, its word saying where it is now), Ctrl-o, Ctrl-i and Backspace on its empty field (after its refinements) roll it up unlanded and walk on (Pick.walkOn; past the last word the jump list's step alone, Jump.listBy); Ctrl-i in it is Tab, a mark, where the terminal cannot tell them apart; onto a search's word, the caret back where the search started and its places lit (Prompt.light, Look's without the select): `Step.search` is a `Search` that holds its start, path, line and column, recorded as `/` commits (Prompt.word from Places.origin) and by `*`; the pane is then at that word (`cur` on it: Trail.backs writes it before the path, n and N walk it, keep keeps it, a step from it keeps it, go and replaceStep never write a place over it); a held pane walks its own words, a search's and a recipe's; a list no longer kept is said (`walk: that list is gone: the last 8 are kept`) and passed by; the owner is no word to walk; Jumps new-pane walks nothing, as before; D8's fold takes places only: each run of places older than the newest `whole` back steps (or past the first two forward) is one `+N` where it starts, a list's word folds only where the tag keeps its newest step alone and never the newest list's, a search's or a recipe's never (Trail.folds; draw.zig dims every run's `+N`); after a landing (Pick.listed) and a search's Enter (Prompt.land) the notice row says, as an echo never logged, what the next Ctrl-o reaches, `C-o back to Find words 1/1` (Trail.sayBack); THE CAUSE of the user's trouble (UX L1): Trail.walkBy skipped every word but a place (`if (t.steps[i] != .place) continue;`), so Ctrl-o after the search went to main.zig:1, past both the search and the list, and nothing said which key would pop; RUN (TEST FIRST): Jump.zig "Ctrl-o pops the walk one word at a time (UX L'1) ..." (W2's test extended) types the user's keys in an 84x20 session of main.zig (SPC f f words, Enter, /in_word, Enter, then Ctrl-o x3 and Ctrl-i x3) and asks after each key the file, the trail's four steps and where the pane is among them, the caret's line, Find words unrolled or not and the search lit or not, then Esc from a reopened list (as before the Ctrl-o), its Enter (the search's word and the place after it dropped, `Find words 1/1` kept) and Backspace on its empty field (walks on to main.zig): fails on the base at Jump.zig:565 on the first Ctrl-o (expected words.zig, found main.zig), passes now; Trail.zig "the fold takes places alone (UX L'1) ..." (runs of places each a `+N`, a click on each its newest, two lists with the newest step alone, a search's word never) and "a held pane walks its own words (UX L'1) ..." (Ctrl-o puts the caret at 20:3 where `/line 9` began, its places lit; past it the jump list's); the notice-row test of walk UI G 2e now reads the echo, then the caret's place once it is retired; a user hit it on every Ctrl-o after a picker's Enter or a search; goldens re-recorded: find and fsearch (the notice row after a picker's Enter and a search's Enter reads the echo); ttyhelp is the merge's placeholder (M1 re-records it); the perf cell walk-pop (test/perf.zig, run only when named: Ctrl-o onto a list word reopening it in the key's own frame, then Esc), 326 us a pair on small in ReleaseFast; core-test 1124/1298 (173 skipped; the G 2e notice-row test, failing on the echo, updated and passing alone), shell-test 1346/1349 (3 skipped), behaviour-test 280/280, pane-test 183/184, process-test 3 of 147 failed before the two goldens moved (find, fsearch: the echo; ttyhelp the placeholder); load 2.2 to 7.2 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- test/perf.zig | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'test/perf.zig') diff --git a/test/perf.zig b/test/perf.zig index 00a5524a..2ea666c4 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -86,12 +86,16 @@ const Op = enum { /// the tag states' keys compare with (key-down's frames each draw /// another place of the file). rest_keys, + /// Ctrl-o from a list's landing onto its word (UX L'1): the list + /// reopened as it was left, its head and band drawn in the key's frame; + /// Esc back to rest and its frame (two keys, two frames). + walk_pop, /// Run only when named (`--op`): a full run, its cells and the sums a /// gate takes over them (perfops' "terminal on all") are as before. fn named(o: Op) bool { return switch (o) { - .spc, .spc_down, .help_type, .describe, .rest_keys => true, + .spc, .spc_down, .help_type, .describe, .rest_keys, .walk_pop => true, else => false, }; } @@ -118,6 +122,7 @@ const Op = enum { .help_type => "help-type", .describe => "describe", .rest_keys => "rest-keys", + .walk_pop => "walk-pop", }; } }; @@ -622,7 +627,7 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u switch (op) { .image_frame => return measureImage(std.fs.path.dirname(path).?, samples, warmup), .client_key_down, .client_edit_char, .client_delete_undo => return measureClient(op, path, reps), - .spc, .spc_down, .help_type, .describe, .rest_keys => return measureTag(op, path, reps), + .spc, .spc_down, .help_type, .describe, .rest_keys, .walk_pop => return measureTag(op, path, reps), else => {}, } if (op == .open) { @@ -677,7 +682,7 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u const wheel_row = rect.y + pardes.BOX_H; const t0 = nowNs(); switch (op) { - .open, .image_frame, .client_key_down, .client_edit_char, .client_delete_undo, .spc, .spc_down, .help_type, .describe, .rest_keys => unreachable, + .open, .image_frame, .client_key_down, .client_edit_char, .client_delete_undo, .spc, .spc_down, .help_type, .describe, .rest_keys, .walk_pop => unreachable, .render, .deep_selection => {}, .key_down => core.update(.{ .key = .{ .cp = 'j', .text = "j" } }), .key_right => core.update(.{ .key = .{ .cp = 'l', .text = "l" } }), @@ -691,7 +696,7 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u _ = try frame(core); const dt = nowNs() -| t0; switch (op) { - .open, .image_frame, .client_key_down, .client_edit_char, .client_delete_undo, .spc, .spc_down, .help_type, .describe, .rest_keys => unreachable, + .open, .image_frame, .client_key_down, .client_edit_char, .client_delete_undo, .spc, .spc_down, .help_type, .describe, .rest_keys, .walk_pop => unreachable, .body_write => if (pane.file.?.content.len != before.len + 8 * body_chunk.len) return error.BodyWriteWasNotAppended, .body_appends => if (pane.file.?.content.len != before.len + append_count * append_chunk_len) return error.BodyAppendsWereNotAppended, .render, .deep_selection => if (pane.body.cur_row != before.row or pane.body.cur_col != before.col or pane.file.?.content.len != before.len) @@ -790,8 +795,17 @@ fn measureTag(op: Op, path: []const u8, reps: usize) !Cell { pump(core); const id = filePane(core) orelse return error.OpenDidNotOpenFile; core.view().active = id; + // A list of two places in the file, landed on its first (a reading + // pane's step): the list's word in its trail before the place. + if (op == .walk_pop) { + core.settings.jumps = .walk; + const rows = try std.fmt.allocPrint(gpa, "{s}:10:1 a\n{s}:20:1 b\n", .{ path, path }); + defer gpa.free(rows); + pardes.Pick.open(core, id, .list, "Refs", "", rows); + } const enter: []const Key = switch (op) { .spc, .rest_keys => &.{}, + .walk_pop => &.{.{ .cp = Key.enter }}, .spc_down => &.{ .{ .cp = ' ', .text = " " }, .{ .cp = Key.down } }, .help_type => &.{ .{ .cp = ' ', .text = " " }, .{ .cp = '?', .text = "?" } }, .describe => &.{ .{ .cp = ' ', .text = " " }, .{ .cp = 'h', .text = "h" }, .{ .cp = 'k', .text = "k" } }, @@ -806,8 +820,11 @@ fn measureTag(op: Op, path: []const u8, reps: usize) !Cell { .help_type => &.{ .{ .cp = 'e', .text = "e" }, .{ .cp = Key.backspace } }, .describe => &.{ .{ .cp = 'g', .text = "g" }, .{ .cp = 'd', .text = "d" } }, .rest_keys => &.{ .{ .cp = 'j', .text = "j" }, .{ .cp = 'k', .text = "k" } }, + .walk_pop => &.{ .{ .cp = 'o', .ctrl = true }, .{ .cp = Key.escape } }, else => unreachable, }; + const landed = core.panes[id].?.trail.cur; + if (op == .walk_pop and (landed == 0 or core.panes[id].?.trail.steps[landed - 1] != .list)) return error.ListDidNotLand; const s = &core.view().tag_state; for (0..warmup + samples.len) |n| { const t0 = nowNs(); @@ -822,6 +839,8 @@ fn measureTag(op: Op, path: []const u8, reps: usize) !Cell { if (!pardes.TagState.shown(core, core.view())) return error.LevelNotShown; _ = try frame(core); } + // The list reopened by the key itself, drawn in its frame. + if (op == .walk_pop and k.ctrl and pardes.Pick.live(core) == null) return error.ListNotReopened; } const dt = nowNs() -| t0; const held = switch (op) { @@ -830,6 +849,7 @@ fn measureTag(op: Op, path: []const u8, reps: usize) !Cell { .help_type => s.kind == .help and s.field.len == 0 and s.nhits > 0, .describe => s.kind == .describe and s.found, .rest_keys => s.kind == .rest and s.root == null and core.panes[id].?.body.cur_row == 0, + .walk_pop => s.kind == .rest and core.panes[id].?.trail.cur == landed and core.panes[id].?.body.cur_row == 9, else => unreachable, }; if (!held) return error.TagStateLost; -- cgit v1.3 From df964ae2f14d21a4799d52a07abfe3b2bef3c65e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 26 Nov 2026 01:40:25 -0300 Subject: ansi, Term, term/terminal, abi/term: a terminal's colours from the chrome (the themes programme's L2d; DESIGN.md R1, R14, R15, B6): the paint and the filter take the page, its text, its dim ink and the sixteen the theme resolved once a theme change (`Chrome.page`, `Chrome.ansi`), never the theme's own fields: a theme with no sixteen of its own draws a program's in the ones worked out for it (R14: its own hues within 30 degrees, else canonical ones, held 4.5:1 on its page), where the cells named an index and each frontend drew its own palette (the tty the host's, the window ghostty's, the Mac Tango: three for one index); a theme that leaves its page to the host (`dark`) leaves page, text and sixteen to a tty as before (`Ink.host`), and in a window draws the null page, its text and its sixteen (R1, R14: "the window uses its ansi"); the filter's base is that sixteen and its 256 targets ghostty's generator over it, made once a theme (FilterPalette, keyed by the theme's values: no reimplemented generator, no per-frame make), where the base for a theme without a palette was made of its roles (ANSI 1 the keyword, 5 the selection, 13 its ink: C1's surfaces.md §3.10) and the page of `dark` was its tag (`ink.bg orelse ink.tag_bg`, #2c2a3e under a #121212 window: §3.1); SGR faint on the page's text is the page's dim ink (R15: the text toward the page to 3.5:1, so as faint on a light page as on a dark one), where a tty halved its brightness toward black and a window took 60 % of it (faint on a coloured ink stays the frontend's, L2e's); Ink is {fg, bg, dim, ansi, host} (abi/term.zig: `tag_fg`, `tag_bg`, `palette` and `base` deleted), ansi.inkOf takes the core (its chrome and its view's frontend); RUN (TEST FIRST): test/terminal.zig "a theme that leaves its page to the host (`dark`) draws a terminal's page, text, faint and sixteen as the null page and its own in a window, and leaves them to a tty; its filter keys to that page, never its tag": in a window a plain cell on #121212 in dark's text, SGR 31 in `ansi[1]`, SGR 2 in `page.dim` and not faint; in a tty `.default`, index 1, faint; the filter's page the null page and its ink the text: on the base the window's cells are `.default`, index 1 and faint and the filter's page dark's tag (the old Ink had no page to give: `ink.bg orelse ink.tag_bg`); the Filter tests re-pinned to the chrome: helix's SGR 31 raw is its resolved `ansi[1]` (was index 1), the `F` cell's faint on the page's text its dim ink (was the text, faint), a reversed explicit cell's ink the chrome's page, the in-place custom theme now a ThemeFile's way (its sixteen changed and its chrome worked out: finishThemeInitialization) where it poked the keyword the old base mapped to ANSI 1, the theme loops by setThemeIndex (they set `settings.theme` under a chrome worked out for another) and with `dark` among them; test/panes.zig's TerminalTests that assert a program's raw indices (an edit buffer sliding rows and their colours, a combining mark, an emoji prompt, a swallowed row, an emptied buffer, the overlay in tty mode, colours never taken from rows below the viewport: seven failed on helix's indices now its resolved sixteen, and the last would have kept passing while proving nothing) take `dark` in a tty, which leaves the sixteen to the host as helix's missing palette did; the wide glyph's last column keeps helix (a page of its own, so the body draws every cell) and asks its resolved red; goldens re-recorded: load.golden row 7 and headersweep-restored.golden rows 6, 14, 15 and 21: the `── restored history ──` banner (SGR 2, terminal.zig's restored_banner) in orchard's page dim ink #666f68 where the tty drew #e5eee5 faint, and the blank cells after it on its row the same fg (vaxis erases the rest of a row in its last SGR; nothing drawn there); pagercolor.golden, theme.golden and themesel.golden unchanged (every native and ported theme in them has its sixteen); GATES: core-test 1123/1296 (173 skipped), term-test 17/17, pane-test 184/185 (1 skipped: base 183/184, +1 the dark test), process-test 145 of 147 and the two re-recorded (3 skipped); load 3.4 to 7.8 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 --- abi/term.zig | 34 +++++----- core/File.zig | 2 +- core/ansi.zig | 35 ++-------- core/term/terminal.zig | 19 +++--- test/panes.zig | 28 ++++---- test/perf.zig | 2 +- test/snapshots/headersweep-restored.golden | 6 +- test/snapshots/load.golden | 4 +- test/terminal.zig | 103 +++++++++++++++++++++-------- 9 files changed, 132 insertions(+), 101 deletions(-) (limited to 'test/perf.zig') diff --git a/abi/term.zig b/abi/term.zig index e84d6998..2fb7c260 100644 --- a/abi/term.zig +++ b/abi/term.zig @@ -136,33 +136,33 @@ pub const Span = struct { start: u32, end: u32, style: CellStyle }; // ---- its colours on the body ---- -/// A theme's colours as a terminal's paint takes them. +/// A theme's colours as a terminal's paint takes them, worked out with the +/// theme (colors.Chrome, DESIGN.md R1, R14, R15): its page, its text, SGR +/// faint's ink on it, and its sixteen, which the filter keys a program's +/// colours to as well. `host`: a theme that leaves its page and sixteen to +/// the tty (`dark`), drawn in a tty, whose cells then name the tty's own. pub const Ink = struct { - fg: ?[3]u8, - bg: ?[3]u8, - tag_fg: [3]u8, - tag_bg: [3]u8, - /// The theme's own sixteen, when it has them. - palette: ?[16][3]u8, - /// The sixteen the filter keys a program's colours to: `palette`, else - /// made of the theme's roles. - base: [16][3]u8, - - /// A palette index as the theme draws it: its own sixteen, else the - /// index. + fg: [3]u8, + bg: [3]u8, + dim: [3]u8, + ansi: [16][3]u8, + host: bool, + + /// A palette index as the theme draws it: its sixteen, else the index. pub fn palColor(ink: *const Ink, idx: u8) Color { - if (ink.palette) |pal| if (idx < 16) return .{ .rgb = pal[idx] }; + if (!ink.host and idx < 16) return .{ .rgb = ink.ansi[idx] }; return .{ .index = idx }; } }; -/// The theme's 256 colours as the filter maps onto them, kept while the -/// theme is the same (`Pardes.tty_filter_palette`). +/// The theme's 256 colours as the filter maps onto them (ghostty's +/// generator over its sixteen, page and text), made once a theme and kept +/// while it is the same (`Pardes.tty_filter_palette`). pub const FilterPalette = struct { key: ?Key = null, colors: [256][3]u8 = undefined, - pub const Key = struct { bg: [3]u8, fg: [3]u8, base: [16][3]u8 }; + pub const Key = struct { bg: [3]u8, fg: [3]u8, ansi: [16][3]u8 }; }; /// A program's colours mapped to the theme, once a frame: what a +Pager's diff --git a/core/File.zig b/core/File.zig index 0f9178ac..332499b4 100644 --- a/core/File.zig +++ b/core/File.zig @@ -2942,7 +2942,7 @@ pub fn recolorSyntax(p: *Pardes, s: *Surface, pane: *Pane, f: *State, r: pardes. // A row whose first byte names a hue (syntax.ground_add, _del): its // grounds, the theme's, worked out once a frame and only for one. var grounds: ?Colors.Grounds = null; - const ink = ansi.inkOf(p.theme()); + const ink = ansi.inkOf(p); var filtered_storage: pardes.Term.Filter = undefined; const filtered: ?*pardes.Term.Filter = if (pane.tty_filter and spans.len > 0) blk: { filtered_storage = pardes.Term.filter(&ink, &p.tty_filter_palette); diff --git a/core/ansi.zig b/core/ansi.zig index 3772de43..3fb866fc 100644 --- a/core/ansi.zig +++ b/core/ansi.zig @@ -20,33 +20,12 @@ const Surface = pardes.Surface; const BodyWalk = @import("body_layer.zig").BodyWalk; const EditBuffer = panes.Text.EditBuffer; -/// The theme's colours as a terminal's paint takes them. -pub fn inkOf(theme: *const pardes.LegacyTheme) Term.Ink { - return .{ - .fg = theme.fg, - .bg = theme.bg, - .tag_fg = theme.tag_fg, - .tag_bg = theme.tag_bg, - .palette = theme.palette, - .base = theme.palette orelse .{ - theme.bg orelse theme.tag_bg, - theme.kw, - theme.str, - theme.num, - theme.box, - theme.sel_bg, - theme.comment, - theme.fg orelse theme.tag_fg, - theme.lineno, - theme.kw, - theme.str, - theme.num, - theme.scroll_thumb, - theme.sel_fg, - theme.tag_fg, - theme.fg orelse theme.tag_fg, - }, - }; +/// The theme's colours as a terminal's paint takes them (Chrome's: its page, +/// text, faint and sixteen); a theme that leaves them to the host (`dark`) +/// leaves them to a tty, and a window draws its own (DESIGN.md R14). +pub fn inkOf(p: *const Pardes) Term.Ink { + const c = p.chrome(); + return .{ .fg = c.page.text, .bg = c.page.ground, .dim = c.page.dim, .ansi = c.ansi, .host = c.host_page and !p.view().frontend.windowed }; } /// Its program's colours over the body's rows, through the theme's filter @@ -85,7 +64,7 @@ pub fn recolor(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, tx: u16, tw { const tz_paint = tracy.zone(@src(), "termPaint"); defer tz_paint.end(); - const ink = inkOf(p.theme()); + const ink = inkOf(p); Term.paint(state, &ink, &p.tty_filter_palette, pane.tty_filter, pane.scrolled_to, @intCast(lo), cols, cells, rows); } const filtered = pane.tty_filter; diff --git a/core/term/terminal.zig b/core/term/terminal.zig index 88eb1443..1c2310b1 100644 --- a/core/term/terminal.zig +++ b/core/term/terminal.zig @@ -418,10 +418,10 @@ pub const min_contrast: f64 = 1.5; /// `generate256Color` over the theme's sixteen), made again only when the /// theme's are not the ones `cache` was made of. pub fn filterPalette(cache: *FilterPalette, ink: *const Ink) *const [256][3]u8 { - const wanted: FilterPalette.Key = .{ .bg = ink.bg orelse ink.tag_bg, .fg = ink.fg orelse ink.tag_fg, .base = ink.base }; + const wanted: FilterPalette.Key = .{ .bg = ink.bg, .fg = ink.fg, .ansi = ink.ansi }; if (cache.key) |old| if (std.meta.eql(old, wanted)) return &cache.colors; var seed = GColor.default; - for (ink.base, 0..) |rgb, i| seed[i] = asGhostRgb(rgb); + for (ink.ansi, 0..) |rgb, i| seed[i] = asGhostRgb(rgb); const colors = GColor.generate256Color(seed, .empty, asGhostRgb(wanted.bg), asGhostRgb(wanted.fg), false); for (&cache.colors, colors) |*dst, src| dst.* = asTriple(src); cache.key = wanted; @@ -1333,6 +1333,12 @@ fn cellStyle(ink: *const Ink, ci: ghostty_vt.PageList.Cell, filtered: ?*Filter, }, else => {}, }; + // SGR faint on the page's text is the page's dim ink (DESIGN.md R15): + // toward the page, so as faint on a light theme as on a dark one. + if (cs.dim and std.meta.eql(cs.fg, plain.Color{ .rgb = ink.fg })) { + cs.fg = .{ .rgb = ink.dim }; + cs.dim = false; + } return cs; } @@ -1353,8 +1359,8 @@ pub fn filterOf(ink: *const Ink, palette: *FilterPalette, vt: ?*const ghostty_vt for (&source, 0..) |*rgb, i| rgb.* = t.colorForXterm(.{ .palette = @intCast(i) }) orelse rgb.*; } - var theme_bg = asGhostRgb(ink.bg orelse ink.tag_bg); - var theme_fg = asGhostRgb(ink.fg orelse ink.tag_fg); + var theme_bg = asGhostRgb(ink.bg); + var theme_fg = asGhostRgb(ink.fg); var dynamic_bg = if (vt) |t| t.colorForXterm(.{ .dynamic = .background }) else null; var dynamic_fg = if (vt) |t| t.colorForXterm(.{ .dynamic = .foreground }) else null; if (vt != null and vt.?.modes.get(.reverse_colors)) { @@ -1504,10 +1510,7 @@ fn colorDistance(a: GColor.RGB, b: GColor.RGB) u32 { fn ghostColor(ink: *const Ink, color: ghostty_vt.Style.Color, is_bg: bool) plain.Color { return switch (color) { - .none => blk: { - const t = if (is_bg) ink.bg else ink.fg; - break :blk if (t) |c| .{ .rgb = c } else .default; - }, + .none => if (ink.host) .default else .{ .rgb = if (is_bg) ink.bg else ink.fg }, .palette => |idx| ink.palColor(idx), .rgb => |rgb| .{ .rgb = .{ rgb.r, rgb.g, rgb.b } }, }; diff --git a/test/panes.zig b/test/panes.zig index 74988a0a..3acd5769 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -2322,9 +2322,11 @@ const ImageTests = struct { }; const TerminalTests = struct { - // Tests asserting raw ANSI indices explicitly select helix, whose palette - // is inherited. Native-palette coverage lives in the overlay/eviction and - // trailing-blank tests and checks their concrete RGB values instead. + // Tests asserting raw ANSI indices explicitly select `dark` in a tty, + // which leaves its page and sixteen to the host (a theme with no sixteen + // of its own draws the ones worked out for it, DESIGN.md R14). Native- + // palette coverage lives in the overlay/eviction and trailing-blank tests + // and checks their concrete RGB values instead. const forwardKey = pardes.keys.forwardKey; const enterTty = pardes.keys.enterTty; @@ -2598,7 +2600,7 @@ const TerminalTests = struct { test "an edit buffer slides shell rows and their colors together" { const testing = std.testing; - const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 12 }); + const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 12 }); defer p.deinit(); while (p.nextEffect()) |_| {} const pane = p.panes[0].?; @@ -2648,7 +2650,7 @@ const TerminalTests = struct { test "a combining mark in the prompt keeps the command and its colors aligned" { const testing = std.testing; - const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 6 }); + const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 6 }); defer p.deinit(); while (p.nextEffect()) |_| {} const pane = p.panes[0].?; @@ -2682,7 +2684,7 @@ const TerminalTests = struct { test "colors are never taken from shell rows below the viewport" { const testing = std.testing; - const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 14 }); + const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 14 }); defer p.deinit(); while (p.nextEffect()) |_| {} const pane = p.panes[0].?; @@ -2740,7 +2742,7 @@ const TerminalTests = struct { test "a row the edit buffer only swallowed keeps its color" { const testing = std.testing; - const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 12 }); + const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 12 }); defer p.deinit(); while (p.nextEffect()) |_| {} const pane = p.panes[0].?; @@ -2777,7 +2779,7 @@ const TerminalTests = struct { test "an edit buffer reaching past the dumped rows colors nothing from row zero" { const testing = std.testing; - const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 12 }); + const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 12 }); defer p.deinit(); while (p.nextEffect()) |_| {} const pane = p.panes[0].?; @@ -2853,7 +2855,7 @@ const TerminalTests = struct { }; for (prompts) |prompt| { for ([_]bool{ false, true }) |filter| { - const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 24, .rows = 6 }); + const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 24, .rows = 6 }); defer p.deinit(); while (p.nextEffect()) |_| {} const pane = p.panes[0].?; @@ -3035,6 +3037,8 @@ const TerminalTests = struct { // ghostty leaves a `spacer_head` in that last column, carrying the row's // background, and wraps the glyph to the next row. A head OWNS its column, // so skipping it the way a tail is skipped left the row's final column bare. + // A theme with a page of its own (helix): every cell of the row is the + // body's, its red the sixteen worked out for it. for ([_]panes.Text.Mode{ .tty, .normal }) |mode| { const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 16, .rows = 9 }); defer p.deinit(); @@ -3052,7 +3056,7 @@ const TerminalTests = struct { p.shell_rows.stale = true; const s = try p.render(frame.allocator()); - const red: pardes.Color = .{ .index = 1 }; + const red: pardes.Color = .{ .rgb = p.chrome().ansi[1] }; var c: u16 = 0; while (c < r.w -| config.GUTTER) : (c += 1) { errdefer std.debug.print("\nmode={any} col {d} bg={any}\n", .{ mode, c, s.at(tx + c, body_y).style.bg }); @@ -3187,7 +3191,7 @@ const TerminalTests = struct { test "an emptied edit buffer does not shift the colors below it" { const testing = std.testing; - const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 12 }); + const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 12 }); defer p.deinit(); while (p.nextEffect()) |_| {} const pane = p.panes[0].?; @@ -3221,7 +3225,7 @@ const TerminalTests = struct { test "an edit overlay never changes tty-mode ansi colors" { const testing = std.testing; - const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 7 }); + const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 7 }); defer p.deinit(); while (p.nextEffect()) |_| {} const pane = p.panes[0].?; diff --git a/test/perf.zig b/test/perf.zig index 00a5524a..2b5f7dfa 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -1010,7 +1010,7 @@ fn checkTerminalTail(core: *pardes.Pardes, surface: *pardes.Surface, batch: usiz // The program's green (SGR 32) as the pane draws it with its filter off // (measureTerminalSession turns it off): the theme's own colour 2. std.debug.assert(!pane.tty_filter); - const green = pardes.ansi.inkOf(core.theme()).palColor(2); + const green = pardes.ansi.inkOf(core).palColor(2); for (expected, 0..) |byte, col| { const cell = surface.at(x + @as(u16, @intCast(col)), y); if (!std.mem.eql(u8, cell.grapheme(), &.{byte})) return error.LatestTerminalTailMissing; diff --git a/test/snapshots/headersweep-restored.golden b/test/snapshots/headersweep-restored.golden index f7e5b2a4..26a0c80b 100644 --- a/test/snapshots/headersweep-restored.golden +++ b/test/snapshots/headersweep-restored.golden @@ -5,7 +5,7 @@ |3: 0-1 d,#314738, 2-59 #becfc4,#314738, 60-61 #becfc4,#1d2824, 62-119 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, -|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-23 #e5eee5,#0d1410,f 24-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-61 #e5eee5,#0d1410, 62-83 #e5eee5,#0d1410,f 84-119 #e5eee5,#0d1410, +|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #666f68,#0d1410, 60-60 #666f68,#608269, 61-119 #666f68,#0d1410, |7: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |8: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |9: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, @@ -14,7 +14,7 @@ |12: 0-1 d,#1d2824, 2-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |13: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |14: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, -|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-23 #e5eee5,#0d1410,f 24-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, +|15: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #666f68,#0d1410, 60-60 #666f68,#608269, 61-119 #666f68,#0d1410, |16: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |17: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |18: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, @@ -46,7 +46,7 @@ |0: 0-1 d,#1d2824, 2-100 #b2c3b8,#1d2824, 101-108 #f5f7ee,#5b7e5a, 109-119 #b2c3b8,#1d2824, |1: 0-1 d,#887455, 2-59 #becfc4,#314738, 60-61 #becfc4,#887455, 62-119 #b2c3b8,#1d2824, |13: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, -|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-23 #e5eee5,#0d1410,f 24-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #666f68,#0d1410, 60-60 #666f68,#608269, 61-119 #666f68,#0d1410, |15: 0-0 d,#152019, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |16: 0-1 d,#496656, 2-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |17: 0-1 d,#1d2824, 2-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, diff --git a/test/snapshots/load.golden b/test/snapshots/load.golden index bb28bbfe..1b3b4801 100644 --- a/test/snapshots/load.golden +++ b/test/snapshots/load.golden @@ -38,7 +38,7 @@ |4: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |5: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |6: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, -|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-51 #e5eee5,#0d1410, 52-73 #e5eee5,#0d1410,f 74-99 #e5eee5,#0d1410, +|7: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-51 #e5eee5,#0d1410, 52-99 #666f68,#0d1410, |8: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |9: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |10: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, @@ -52,7 +52,7 @@ |18: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, -|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-23 #e5eee5,#0d1410,f 24-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #666f68,#0d1410, 50-50 #666f68,#608269, 51-99 #666f68,#0d1410, |22: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, |23: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, |24: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, diff --git a/test/terminal.zig b/test/terminal.zig index 5cf853e7..1168fac7 100644 --- a/test/terminal.zig +++ b/test/terminal.zig @@ -269,7 +269,8 @@ test "rows asked for after a pane's cached rows were dropped, before the sweep, test "terminal Filter keys indexed truecolor OSC and background-only cells through the theme" { const testing = std.testing; - // Raw index assertions require a theme that inherits the ANSI palette. + // A theme with no sixteen of its own (helix): a program's sixteen drawn + // in the ones worked out for it (DESIGN.md R14), the rest as they are. const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 7 }); defer p.deinit(); while (p.nextEffect()) |_| {} @@ -295,7 +296,7 @@ test "terminal Filter keys indexed truecolor OSC and background-only cells throu const body_y = p.bodyTop(pane, r); const raw = try p.render(frame.allocator()); - try testing.expectEqual(plain.Color{ .index = 1 }, raw.at(tx, body_y).style.fg); + try testing.expectEqual(plain.Color{ .rgb = p.chrome().ansi[1] }, raw.at(tx, body_y).style.fg); try testing.expectEqual(plain.Color{ .index = 196 }, raw.at(tx + 1, body_y).style.fg); try testing.expectEqual(plain.Color{ .rgb = .{ 255, 0, 0 } }, raw.at(tx + 2, body_y).style.fg); @@ -303,7 +304,7 @@ test "terminal Filter keys indexed truecolor OSC and background-only cells throu _ = frame.reset(.retain_capacity); const filtered = try p.render(frame.allocator()); var expected_cache: FilterPalette = .{}; - const expected = filterPalette(&expected_cache, &ansi.inkOf(p.theme())); + const expected = filterPalette(&expected_cache, &ansi.inkOf(p)); try testing.expectEqual(asPardesColor(asGhostRgb(expected[1])), filtered.at(tx, body_y).style.fg); try testing.expectEqual(asPardesColor(asGhostRgb(expected[196])), filtered.at(tx + 1, body_y).style.fg); try testing.expectEqual(filtered.at(tx + 1, body_y).style.fg, filtered.at(tx + 2, body_y).style.fg); @@ -312,7 +313,9 @@ test "terminal Filter keys indexed truecolor OSC and background-only cells throu const attrs = filtered.at(tx + 5, body_y).style; try testing.expect(attrs.bold); - try testing.expect(attrs.dim); + // Faint on the page's text: the page's dim ink (DESIGN.md R15). + try testing.expect(!attrs.dim); + try testing.expectEqual(plain.Color{ .rgb = p.chrome().page.dim }, attrs.fg); try testing.expect(attrs.italic); try testing.expect(attrs.blink); try testing.expect(attrs.reverse); @@ -374,7 +377,7 @@ test "terminal Filter keys indexed truecolor OSC and background-only cells throu try testing.expectEqual(asPardesColor(asGhostRgb(expected[196])), reversed_blank.bg); const reversed_explicit = reversed.at(tx, body_y).style; try testing.expectEqual(asPardesColor(asGhostRgb(expected[196])), reversed_explicit.bg); - try testing.expectEqual(plain.Color{ .rgb = p.theme().bg.? }, reversed_explicit.fg); + try testing.expectEqual(plain.Color{ .rgb = p.chrome().page.ground }, reversed_explicit.fg); try testing.expect(!std.meta.eql(reversed_explicit.fg, reversed_explicit.bg)); p.update(.{ .output = .{ .pane = .at(0), .bytes = "\x1b[?5l" } }); @@ -384,31 +387,74 @@ test "terminal Filter keys indexed truecolor OSC and background-only cells throu try testing.expectEqual(asPardesColor(asGhostRgb(expected[196])), unreversed_blank.fg); try testing.expectEqual(asPardesColor(asGhostRgb(expected[59])), unreversed_blank.bg); - // The cache is keyed by values, not a theme name. Replacing a custom - // theme in place immediately recolours already-rendered indexed cells. + // The cache is keyed by values, not a theme name. A custom theme of the + // same name with another sixteen, its chrome worked out (as a + // ThemeFile's load does), recolours already-rendered indexed cells. p.update(.{ .output = .{ .pane = .at(0), .bytes = "\x1b]104;1\x1b\\" } }); var custom = p.theme().*; custom.name = try p.gpa.dupe(u8, "same-name"); - custom.palette = null; - custom.kw = .{ 1, 2, 3 }; + custom.palette = pardes.colors.xterm[0..16].*; + custom.palette.?[1] = .{ 1, 2, 3 }; p.custom_theme = custom; + pardes.colors.finishThemeInitialization(p); _ = frame.reset(.retain_capacity); const custom_first = try p.render(frame.allocator()); try testing.expectEqual(plain.Color{ .rgb = .{ 1, 2, 3 } }, custom_first.at(tx, body_y).style.fg); - if (p.custom_theme) |*theme| theme.kw = .{ 4, 5, 6 }; + if (p.custom_theme) |*theme| theme.palette.?[1] = .{ 4, 5, 6 }; + pardes.colors.finishThemeInitialization(p); _ = frame.reset(.retain_capacity); const custom_second = try p.render(frame.allocator()); try testing.expectEqual(plain.Color{ .rgb = .{ 4, 5, 6 } }, custom_second.at(tx, body_y).style.fg); } +test "a theme that leaves its page to the host (`dark`) draws a terminal's page, text, faint and sixteen as the null page and its own in a window, and leaves them to a tty; its filter keys to that page, never its tag (DESIGN.md R1, R14, R15)" { + const testing = std.testing; + for ([_]bool{ false, true }) |windowed| { + const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .cols = 18, .rows = 7, .windowed = windowed }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + const pane = p.panes[0].?; + pane.tag_expanded = false; + pane.tty_filter = false; + p.update(.{ .output = .{ .pane = .at(0), .bytes = "A\x1b[31mB\x1b[0;2mC" } }); + p.sync(); + var frame = std.heap.ArenaAllocator.init(testing.allocator); + defer frame.deinit(); + const r = p.view().rects[0]; + const tx = r.x + config.GUTTER; + const body_y = p.bodyTop(pane, r); + const s = try p.render(frame.allocator()); + const c = p.chrome(); + try testing.expect(c.host_page); + const plain_cell = s.at(tx, body_y).style; + const red = s.at(tx + 1, body_y).style; + const faint = s.at(tx + 2, body_y).style; + if (windowed) { + try testing.expectEqual(plain.Color{ .rgb = pardes.colors.null_page }, plain_cell.bg); + try testing.expectEqual(plain.Color{ .rgb = c.page.text }, plain_cell.fg); + try testing.expectEqual(plain.Color{ .rgb = c.ansi[1] }, red.fg); + try testing.expectEqual(plain.Color{ .rgb = c.page.dim }, faint.fg); + try testing.expect(!faint.dim); + } else { + try testing.expect(plain_cell.bg == .default and plain_cell.fg == .default); + try testing.expectEqual(plain.Color{ .index = 1 }, red.fg); + try testing.expect(faint.dim and faint.fg == .default); + } + var cache: FilterPalette = .{}; + const f = filterOf(&ansi.inkOf(p), &cache, &of(pane.terminal.?).vt); + try testing.expectEqual(pardes.colors.null_page, f.theme_bg); + try testing.expectEqual(c.page.text, f.theme_fg); + } +} + test "terminal Filter keeps extended keys dark-to-light on a light theme" { const p = try Pardes.init(std.testing.allocator, .{ .startup_config = "Theme acme\n", .tty_only = true }); defer p.deinit(); try std.testing.expectEqualStrings("acme", p.theme().name); var cache: FilterPalette = .{}; - const palette = filterPalette(&cache, &ansi.inkOf(p.theme())); - try std.testing.expect(asGhostRgb(palette[16]).eql(asGhostRgb(p.theme().fg.?))); - try std.testing.expect(asGhostRgb(palette[231]).eql(asGhostRgb(p.theme().bg.?))); + const palette = filterPalette(&cache, &ansi.inkOf(p)); + try std.testing.expect(asGhostRgb(palette[16]).eql(asGhostRgb(p.chrome().page.text))); + try std.testing.expect(asGhostRgb(palette[231]).eql(asGhostRgb(p.chrome().page.ground))); } test "terminal Filter preserves exact palette-null light theme default roles" { @@ -423,6 +469,7 @@ test "terminal Filter preserves exact palette-null light theme default roles" { light.fg = .{ 0x38, 0x38, 0x38 }; light.palette = null; p.custom_theme = light; + pardes.colors.finishThemeInitialization(p); const pane = p.panes[0].?; try testing.expectEqual(@as(?GColor.RGB, null), of(pane.terminal.?).vt.colorForXterm(.{ .dynamic = .foreground })); @@ -453,25 +500,23 @@ test "terminal Filter maps the default roles before it maps anything else" { const pane = p.panes[0].?; try testing.expect(pane.tty_filter); - // Native dark/light palettes plus legacy helix/dark/acme, including - // the null-page fallback that only the legacy dark theme exercises. - for (0..9) |t| { - p.settings.theme = @intCast(t); - const stage_one = filterOf(&ansi.inkOf(p.theme()), &p.tty_filter_palette, &of(pane.terminal.?).vt); - // `dark` declares no background of its own, which is exactly why the - // resolver reads the tag colours as the fallback rather than `.?`. - const theme = p.theme(); - try testing.expect(asGhostRgb(stage_one.theme_bg).eql(asGhostRgb(theme.bg orelse theme.tag_bg))); - try testing.expect(asGhostRgb(stage_one.theme_fg).eql(asGhostRgb(theme.fg orelse theme.tag_fg))); + // The first nine of the ring, dark and light, and `dark`, whose page is + // the host's: its filter keys to the null page, never its tag. + for ([_]usize{ 0, 1, 2, 3, 4, 5, 6, 7, 8, pardes.colors.themeIndex("dark").? }) |t| { + pardes.colors.setThemeIndex(p, t); + const stage_one = filterOf(&ansi.inkOf(p), &p.tty_filter_palette, &of(pane.terminal.?).vt); + const page = p.chrome().page; + try testing.expect(asGhostRgb(stage_one.theme_bg).eql(asGhostRgb(page.ground))); + try testing.expect(asGhostRgb(stage_one.theme_fg).eql(asGhostRgb(page.text))); // With no OSC 11 in play the mapped page IS that anchor, and the // fallback is the other one: a background never contrasts with itself. try testing.expect(asGhostRgb(stage_one.default_bg).eql(asGhostRgb(stage_one.theme_bg))); try testing.expect(asGhostRgb(stage_one.fallback_fg).eql(asGhostRgb(stage_one.theme_fg))); } - p.settings.theme = 0; + pardes.colors.setThemeIndex(p, 0); p.update(.{ .output = .{ .pane = .at(0), .bytes = "\x1b]11;#5f5f5f\x1b\\" } }); - var moved = filterOf(&ansi.inkOf(p.theme()), &p.tty_filter_palette, &of(pane.terminal.?).vt); + var moved = filterOf(&ansi.inkOf(p), &p.tty_filter_palette, &of(pane.terminal.?).vt); try testing.expect(!asGhostRgb(moved.default_bg).eql(asGhostRgb(moved.theme_bg))); try testing.expect(asGhostRgb(moved.default_bg).eql(keyedRgb(&moved, .{ .r = 0x5f, .g = 0x5f, .b = 0x5f }))); } @@ -495,8 +540,8 @@ test "terminal Filter refuses a foreground that would collapse onto the page" { const body_y = p.bodyTop(pane, r); for (0..9) |t| { - p.settings.theme = @intCast(t); - var fc = filterOf(&ansi.inkOf(p.theme()), &p.tty_filter_palette, &of(pane.terminal.?).vt); + pardes.colors.setThemeIndex(p, t); + var fc = filterOf(&ansi.inkOf(p), &p.tty_filter_palette, &of(pane.terminal.?).vt); const page = asPardesColor(asGhostRgb(fc.default_bg)); const rescued = asPardesColor(asGhostRgb(fc.fallback_fg)); _ = frame.reset(.retain_capacity); @@ -547,8 +592,8 @@ test "terminal Filter holds every projected foreground off the page" { const pane = p.panes[0].?; for (0..9) |t| { - p.settings.theme = @intCast(t); - var fc = filterOf(&ansi.inkOf(p.theme()), &p.tty_filter_palette, &of(pane.terminal.?).vt); + pardes.colors.setThemeIndex(p, t); + var fc = filterOf(&ansi.inkOf(p), &p.tty_filter_palette, &of(pane.terminal.?).vt); var refused: usize = 0; for (fc.target, 0..) |projected_triple, slot| { const projected = asGhostRgb(projected_triple); -- cgit v1.3