From 1f2653d96656ab55956b5798bf637372ce337e29 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 10:07:05 -0300 Subject: A bound REPL whose program exited is skipped, as the docs say: out of the question, the running one taking the text, and a done command REPL's tag says no id Two bound REPLs always asked, an exited one offered and, chosen, sent nothing. Now an exited one is left out: one still running takes the text with no question, none running is said (`no program running`), and nothing runs as a command. A command pane bound as a REPL whose command is done no longer shows its id in the tag. Co-Authored-By: Claude Opus 5.5 --- src/exec.zig | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/exec.zig') diff --git a/src/exec.zig b/src/exec.zig index 5b170375..ac6efcdd 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -554,16 +554,21 @@ fn routeToRepl(p: *Pardes, from: usize, text: []const u8) Routed { return .{ .sent = from }; } const lang = langOf(src) orelse return .none; - // Every REPL bound for the language, a program running in it or not: - // which one is the text's is never guessed from which happens to be - // running now. + // Every REPL bound for the language whose program still runs: one + // whose program exited is skipped, in the question and in the choice. var bound: [26]usize = undefined; var n: usize = 0; + var exited: ?usize = null; for (p.panes, 0..) |slot, i| if (slot) |pane| if (pane.repl) |r| if (r.lang == lang and n < bound.len) { + if (!replLive(p, i)) { + exited = i; + continue; + } bound[n] = i; n += 1; }; - if (n == 0) return .none; + // Bound but none running: said, never run as a command instead. + if (n == 0) return if (exited) |i| replGone(p, from, p.panes[i].?) else .none; if (n == 1) { if (!replLive(p, bound[0])) return replGone(p, from, p.panes[bound[0]].?); sendToRepl(p, from, bound[0], text); -- cgit v1.3