diff options
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index dab27160..9297c829 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1655,10 +1655,13 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe try std.testing.expectEqualStrings("\r", Sent.said(1)); // Nothing answering, it goes when its wait is up. _ = exec.executeFrom(p, 0, "print(2)", true); - p.stepped_ns += 300 * std.time.ns_per_ms; + p.update(.tick); // on the clock: not yet, however old core time is + Sent.drain(p); + try std.testing.expect(std.mem.endsWith(u8, Sent.said(1), "\x1b[200~print(2)\x1b[201~")); + p.now_ns = p.panes[1].?.repl_enter_due_ns; // the clock reaches its wait p.update(.tick); Sent.drain(p); - try std.testing.expect(std.mem.endsWith(u8, Sent.said(1), "\x1b[200~print(2)\x1b[201~\r")); + try std.testing.expectEqualStrings("\r", Sent.said(1)); p.update(.{ .output = .{ .pane = 1, .bytes = "\x1b[?2004l" } }); Sent.len[1] = 0; // A block left open by its indented last line gets the blank line that @@ -6571,9 +6574,10 @@ pub const Pardes = struct { const wait = Messages.messageWake(p, pane) orelse continue; frames = if (frames) |soonest| @min(soonest, wait) else wait; }; - // A paste's Enter waiting on its REPL goes at the end of its wait. + // A paste's Enter waiting on its REPL goes at the end of its wait, + // a time on the clock: the frames from `stepped_ns` that reach it. for (p.panes) |slot| if (slot) |pane| if (pane.repl_enter > 0) { - const wait = @max(1, (pane.repl_enter_due_ns -| p.stepped_ns) / animation.frame_ns); + const wait = @max(1, (pane.repl_enter_due_ns -| p.stepped_ns + animation.frame_ns - 1) / animation.frame_ns); frames = if (frames) |soonest| @min(soonest, wait) else wait; }; return if (frames) |n| p.stepped_ns + n * animation.frame_ns else null; |
