summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 10:07:05 -0300
committerGabriel Schneider <[email protected]>2026-10-01 10:36:27 -0300
commit1f2653d96656ab55956b5798bf637372ce337e29 (patch)
tree61010e2bb73534a34f6f8bd0398d1b740153fc7f /src/exec.zig
parent3aa24c27c62c740cd7647831d0a14a9b180992da (diff)
downloadpardes-1f2653d96656ab55956b5798bf637372ce337e29.tar.gz
pardes-1f2653d96656ab55956b5798bf637372ce337e29.zip
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 <[email protected]>
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig13
1 files changed, 9 insertions, 4 deletions
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);