diff options
Diffstat (limited to 'src/tty')
| -rw-r--r-- | src/tty/tty.zig | 13 |
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; + } } } |
