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