summaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-03 01:34:50 -0300
committerGabriel Schneider <[email protected]>2026-08-10 09:17:07 -0300
commita774cad033fdc371af9f89b9a787a30ea017481c (patch)
tree321190fb8e3c7708822be9a168c7026d0e4cd819 /src/tty
parentb50005359c9fa33beef9a2ea7496268a246b296e (diff)
downloadpardes-a774cad033fdc371af9f89b9a787a30ea017481c.tar.gz
pardes-a774cad033fdc371af9f89b9a787a30ea017481c.zip
animate anchored theme colors on native and tty backends
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/tty.zig13
1 files changed, 12 insertions, 1 deletions
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;
+ }
}
}