From a774cad033fdc371af9f89b9a787a30ea017481c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 3 Aug 2026 01:34:50 -0300 Subject: animate anchored theme colors on native and tty backends --- test/snapshot.zig | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/snapshot.zig b/test/snapshot.zig index 7c00b97c..0a2b299d 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -617,12 +617,25 @@ fn readProc(buf: []u8, path: [*:0]const u8) ?[]const u8 { return buf[0..@intCast(got)]; } -/// What a `snap` capture is made of: the grid text plus the cursor cell. +/// What a capture is made of: grid text, cursor cell, and a compact digest of +/// every cell style. Style used not to matter to `stable`, which let a +/// color-only animation look idle while the TTY frontend was deliberately +/// asleep between frames; a following `snapstyle` then caught a midpoint. fn stateKey(h: *eh.Harness) ![]u8 { const text = try h.screenText(); defer h.gpa.free(text); const c = h.cursor(); - return std.fmt.allocPrint(h.gpa, "{d},{d}\n{s}", .{ c.x, c.y, text }); + var styles = std.hash.Wyhash.init(0x5354_594c_4553_2121); + var y: u16 = 0; + while (y < h.rows) : (y += 1) { + var x: u16 = 0; + while (x < h.cols) : (x += 1) { + var key_buf: [64]u8 = undefined; + styles.update(cellKey(h, x, y, &key_buf)); + styles.update("\x00"); + } + } + return std.fmt.allocPrint(h.gpa, "{d},{d},{x}\n{s}", .{ c.x, c.y, styles.final(), text }); } fn snapText(arena: std.mem.Allocator, out: *std.ArrayList(u8), h: *eh.Harness, label: []const u8) !void { -- cgit v1.3