summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 21:44:15 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commitdd71a3433fa026794ffc5cc1dd3435984f693540 (patch)
treeef8ae9467e99e1a362a9d3ea311361780c8d8277 /src/pardes.zig
parent86ce788e925bd19297213ef14cf02fa564ae9f10 (diff)
downloadpardes-dd71a3433fa026794ffc5cc1dd3435984f693540.tar.gz
pardes-dd71a3433fa026794ffc5cc1dd3435984f693540.zip
With several REPLs bound for a language the pane always asks which, as documented, whether or not a program runs in each
Only REPLs with a program running were counted, so with two bound and one at its shell prompt the text went to the other without a word, and which REPL got it depended on what happened to be running. All bound REPLs are offered now; one chosen with no program running is sent nothing and says so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 4472df8f..1e5282da 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -1717,14 +1717,20 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe
try std.testing.expect(p.executeBuiltinLine(2, "Repl python"));
try std.testing.expectEqualStrings("python-b", exec.replId(&idbuf, p.panes[2].?));
- // A REPL whose program has left (Ctrl-D: the shell has the tty) is
- // sent nothing, and nothing runs: it says so.
+ // Two bound always ask, whichever has a program running: one left
+ // (Ctrl-D: the shell has the tty) is still offered, and chosen, it is
+ // sent nothing, nothing runs, and that is said.
host.taken[1] = false;
- host.taken[2] = false;
_ = exec.executeFrom(p, 0, "import os", true);
+ try std.testing.expectEqual(Pane.Prompt.repl_choice, file.prompt);
+ p.update(.{ .key = .{ .cp = 'a' } });
Sent.drain(p);
try std.testing.expect(Sent.len[1] == 0 and Sent.len[2] == 0 and !Sent.spawned);
try std.testing.expect(std.mem.indexOf(u8, file.msg[0..file.msg_len], "no program running") != null);
+ host.taken[2] = false;
+ _ = exec.executeFrom(p, 0, "import os", true);
+ try std.testing.expectEqual(Pane.Prompt.repl_choice, file.prompt);
+ p.update(.{ .key = .{ .cp = Key.escape } });
host.taken[1] = true;
host.taken[2] = true;
@@ -6047,7 +6053,12 @@ pub const Pardes = struct {
// The pane offered, still that REPL and still running: it
// may have closed or been rebound while the question stood.
if (p.paneBySerial(serial)) |to| if (p.panes[to].?.repl) |r|
- if (r.lang == ask.lang and r.letter == letter and exec.replLive(p, to)) {
+ if (r.lang == ask.lang and r.letter == letter) {
+ // Offered with no program running: said so, not sent.
+ if (!exec.replLive(p, to)) {
+ _ = exec.replGone(p, id, p.panes[to].?);
+ return true;
+ }
exec.sendToRepl(p, id, to, ask.text);
return true;
};