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 --- src/tty/tty.zig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/tty') diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 908f17d7..6047e5a2 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -527,7 +527,8 @@ pub fn run(init: std.process.Init, opts: pardes.Options) !void { var output = false; var native_pdf_page_changed = false; switch (event) { - .nop, .tick => {}, + .nop => {}, + .tick => core.update(.tick), .quit => stop = true, .winsize => |ws| { try vx.resize(gpa, tty.writer(), ws); @@ -799,6 +800,16 @@ pub fn run(init: std.process.Init, opts: pardes.Options) !void { try vx.render(tty.writer()); tz_render.end(); tracy.frameMark(); + + // A theme transition is the only reason this otherwise event-driven + // frontend redraws on a clock. Sleep on the loop thread, then make the + // next pass a tick; input and worker events can queue during the short + // sleep and are drained in that pass. No timer worker can outlive the + // loop, and at the exact endpoint we return to an indefinite wait. + if (core.themeAnimationActive()) { + std.Io.sleep(io, .fromMilliseconds(pardes.animation.frame_ms), .awake) catch {}; + pending = .tick; + } } } -- cgit v1.3