From 4b64d4b237b2bc5f8197e2232c84c0d1ed1a8fdb Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 04:15:16 -0300 Subject: A multi-line paste into Python's REPL runs whole, back at its prompt The Enter went on Python's first output after the paste, before it had taken in the whole paste, and one Enter leaves a multi-line input at ... anyway. Python's output now only restarts a 100 ms quiet wait (the 250 ms fallback stays), and a paste of more than one line gets the second Enter a block gets. fs.py runs print(11)\nprint(22), the same with a trailing newline, and a for block followed by a statement in a real python3, each back at >>>. Co-Authored-By: Claude Opus 5.5 --- src/pardes.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/pardes.zig') diff --git a/src/pardes.zig b/src/pardes.zig index d6859f86..289dcee0 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1652,7 +1652,21 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe try std.testing.expectEqualStrings("\x1b[200~print(1)\x1b[201~", Sent.said(1)); p.update(.{ .output = .{ .pane = 1, .bytes = "print(1)" } }); Sent.drain(p); + // Python's echo only restarts a short wait: the Enter goes once the + // echo of the whole paste has gone quiet. + try std.testing.expectEqualStrings("", Sent.said(1)); + p.now_ns = p.panes[1].?.repl_enter_due_ns; + p.update(.tick); + Sent.drain(p); try std.testing.expectEqualStrings("\r", Sent.said(1)); + // A paste of more than one line gets the blank line a block gets. + _ = exec.executeFrom(p, 0, "print(11)\nprint(22)", true); + Sent.drain(p); + try std.testing.expectEqualStrings("\x1b[200~print(11)\nprint(22)\x1b[201~", Sent.said(1)); + p.now_ns = p.panes[1].?.repl_enter_due_ns; + p.update(.tick); + Sent.drain(p); + try std.testing.expectEqualStrings("\r\r", Sent.said(1)); // Nothing answering, it goes when its wait is up. _ = exec.executeFrom(p, 0, "print(2)", true); p.update(.tick); // on the clock: not yet, however old core time is -- cgit v1.3