summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-26 01:40:25 -0300
committerGabriel Schneider <[email protected]>2026-11-26 02:12:25 -0300
commitdf964ae2f14d21a4799d52a07abfe3b2bef3c65e (patch)
treebe3880fb9a7b0ab8874d49a69923898b4677e42a /test/panes.zig
parente793644c7192a96ae2e39e072708b059edafaeeb (diff)
downloadpardes-df964ae2f14d21a4799d52a07abfe3b2bef3c65e.tar.gz
pardes-df964ae2f14d21a4799d52a07abfe3b2bef3c65e.zip
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
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig28
1 files changed, 16 insertions, 12 deletions
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].?;