summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/exec.zig b/src/exec.zig
index dfef2dfd..cd2b4089 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -544,9 +544,11 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize {
}
const src = p.panes[from] orelse return null;
const dir = Pardes.paneDir(src);
- const reuse: ?usize = if (src.command != null and src.command_done) from else for (p.panes, 0..) |slot, i| {
+ // Not one whose pty a job it left behind still prints to: reusing it
+ // would hang that job up.
+ const reuse: ?usize = if (src.command != null and src.command_done and !src.command_pty) from else for (p.panes, 0..) |slot, i| {
const other = slot orelse continue;
- if (other.command != null and other.command_done and std.mem.eql(u8, other.cwdSlice(), dir)) break i;
+ if (other.command != null and other.command_done and !other.command_pty and std.mem.eql(u8, other.cwdSlice(), dir)) break i;
} else null;
if (reuse) |id| {
const pane = p.panes[id].?;
@@ -558,13 +560,15 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize {
pane.command = owned;
pane.command_done = false;
pane.command_status = null;
+ pane.command_pty = true;
pane.body.mode = .tty;
// What the last program left the emulator in goes first: the
// alternate screen left (only if it is there: leaving restores a
// saved cursor), mouse reports and bracketed paste off, the cursor
- // shown, then a soft reset (DECSTR) for the rest.
+ // shown, colours reset. (Not DECSTR: ghostty's stream does not
+ // implement it.)
if (panes.Terminal.onAlternateScreen(pane)) panes.Terminal.feedOutput(p, pane, "\x1b[?1049l");
- panes.Terminal.feedOutput(p, pane, "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?2004l\x1b[?25h\x1b[!p");
+ panes.Terminal.feedOutput(p, pane, "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?2004l\x1b[?25h\x1b[0m");
echoCommand(p, pane, line);
p.emit(.{ .spawn = .{ .pane = @intCast(id), .serial = pane.serial, .cwd = .from(pane.cwdSlice()) } });
noteRun(p, pane, "run", line);