summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 751d4026..a9bc38f9 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -914,7 +914,10 @@ pub const Repl = struct {
pub const takes_arg = true;
pub fn run(c: Ctx) void {
const pane = c.pane;
- if (!pane.isTerminal()) return c.p.reportFailure(c.id, "Repl: only a terminal is a REPL");
+ // A terminal with its emulator -- not a document pane -- and not
+ // a command pane whose command, the REPL it would be, is done.
+ if (!pane.isTerminal() or pane.terminal == null) return c.p.reportFailure(c.id, "Repl: only a terminal is a REPL");
+ if (pane.command != null and pane.command_done) return c.p.reportFailure(c.id, "Repl: its command is done; a REPL is a running program");
const arg = std.mem.trim(u8, c.arg orelse "", " \t\r\n");
var buf: [320]u8 = undefined;
var idbuf: [48]u8 = undefined;