summaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/tty.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index e62da55c..b4eb6be9 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -1321,6 +1321,8 @@ const Remote = struct {
_ = std.fmt.bufPrint(why, "the session's dump would not load: {t}\x00", .{err}) catch {};
return null;
};
+ // PARDES_NO_ECHO: no predicted echo (the gates' baseline).
+ if (std.c.getenv("PARDES_NO_ECHO") != null) r.echo.on = false;
if (!r.loaded(joined.digest)) {
r.deinit();
_ = std.fmt.bufPrint(why, "the session's dump loaded as another session (a build's dump is not complete)\x00", .{}) catch {};
@@ -1525,7 +1527,7 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se
try startInput(&loop, &screen);
defer stopInput(io, &screen.thread);
(try std.Thread.spawn(.{}, winchWatch, .{&loop})).detach();
- if (link.check != null) (try std.Thread.spawn(.{}, wakeWatch, .{ io, &loop })).detach();
+ (try std.Thread.spawn(.{}, wakeWatch, .{ io, &loop })).detach();
try screen.vx.queryTerminalSend(screen.tty.writer());
// A join a pass: the first, and one after the replica diverged or the
// session let it go to upgrade. The terminal stays as it is.
@@ -1544,6 +1546,8 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se
sh.winched();
screen.vx.queueRefresh();
while (!link.quit) {
+ // Its predicted echo judged and caught up, once a frame.
+ if (r.echoFrame()) link.dirty = true;
if (link.dirty) link.draw(&sh);
const first = (loop.tryEvent() catch null) orelse idle: {
// Idle, its frame drawn: the next key needs no copy taken.
@@ -1565,7 +1569,9 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se
screen.vx.queueRefresh();
link.dirty = true;
}
- if (link.owed) link.dirty = true;
+ if (link.owed or r.echo.changed) link.dirty = true;
+ // Predictions out: judged a frame at a time while they are.
+ if (r.echo.n > 0 or r.echo.cursor != null or r.echo.nd > 0) requestWake(io, @intCast(pardes.animation.frame_ns / std.time.ns_per_ms));
if (link.check != null) {
// Quiet a while after a change: asked once (a wake, then the
// next quiet one).