From d1300ad4283d9c22a6b0aa7426637a2d0239d536 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 04:16:23 -0300 Subject: perf: the terminal stress cell compiles and its tail check wants what the cell draws: measureTerminalSession and the gesture cells read the emulator through Term.emulatorOf (Term.State became a handle in the terminal's own module, and test/perf.zig's two `state.vt` reaches no longer compiled, so pardes-perf, and the unit-test perf gate with it, did not build on this line); checkTerminalTail wanted a tail cell's colour as palette index 2, written when theme 0 was helix, and since orchard became the default theme (682e237df) a cell with the pane's filter off (as the cell sets it) is the theme's own colour 2 as an RGB: it wants pardes.ansi.inkOf(theme).palColor(2), and asserts the filter is off; test code only; `zig build perf -- --terminal-mib 1` passes (1 MiB in 121 batches) --- test/perf.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/perf.zig b/test/perf.zig index cb4e907e..0f5466ad 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -688,7 +688,7 @@ fn measureTerm(op: TermOp, fx: TermFixture, reps: usize) !Cell { const core = try bootTerm(fx); defer core.deinit(); const pane = core.panes[0] orelse return error.MissingTerminal; - const state = pane.terminal orelse return error.MissingTerminal; + const state = pardes.Term.emulatorOf(pane.terminal orelse return error.MissingTerminal); if (op == .key_down or op == .edit_char) pane.body.mode = .normal; if (op == .edit_char) { core.update(.{ .key = .{ .cp = 'i', .text = "i" } }); @@ -817,10 +817,14 @@ fn checkTerminalTail(core: *pardes.Pardes, surface: *pardes.Surface, batch: usiz const y = rect.y + pardes.BOX_H + pardes.Term.grid(pane.terminal).cursor_y; var expected_buffer: [32]u8 = undefined; const expected = try std.fmt.bufPrint(&expected_buffer, "TURN {d:0>10} READY", .{batch}); + // 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); 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; - if (!std.meta.eql(pardes.Color{ .index = 2 }, cell.style.fg)) return error.LatestTerminalTailStyleWrong; + if (!std.meta.eql(green, cell.style.fg)) return error.LatestTerminalTailStyleWrong; } } @@ -965,7 +969,7 @@ fn measureTerminalSession(io: std.Io, mib: usize, reps: usize, json: bool) !void defer core.deinit(); pump(core); const pane = core.panes[0] orelse return error.MissingTerminal; - const state = pane.terminal orelse return error.MissingTerminal; + const state = pardes.Term.emulatorOf(pane.terminal orelse return error.MissingTerminal); pane.body.mode = .tty; pane.tty_filter = false; var arena: std.heap.ArenaAllocator = .init(counter.allocator()); -- cgit v1.3