diff options
Diffstat (limited to 'src/exec.zig')
| -rw-r--r-- | src/exec.zig | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/exec.zig b/src/exec.zig index ddb89d33..6e6f528b 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -585,8 +585,11 @@ fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize { const dir = p.execDir(from); // 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| { + // From a column's tag, only a finished pane in that column is reused, + // as the new one goes in that column (placeNew). + const reuse: ?usize = if (p.exec_column == null and 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 (p.exec_column) |c| if (if (layout.findPane(p, i)) |f| f.col != c else true) continue; 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| { @@ -838,8 +841,10 @@ pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPan // New: the bottom half of the last pane in its own column // (look.c:921-923, et->col). .scratch => layout.acmePlace(p, p.exec_column orelse columnOf(p, from), null, id), - // +Errors, a command's output: the last column (util.c:94-98). - .command, .errors => layout.acmePlace(p, p.ncol - 1, null, id), + // +Errors, a command's output: the last column (util.c:94-98); + // a command run from a column's tag, that column. + .command => layout.acmePlace(p, p.exec_column orelse p.ncol - 1, null, id), + .errors => layout.acmePlace(p, p.ncol - 1, null, id), // makenewwindow(nil) for 9P's new (acme.c:877), else (t). .fs => layout.acmePlace(p, acmeColumn(p, from), null, id), .shell, .doc => layout.acmePlace(p, acmeColumn(p, from), asked, id), @@ -928,7 +933,7 @@ fn pardesPlace(p: *Pardes, from: usize, id: usize, kind: NewPane) void { .shell => belowParent(p, from, id), .doc, .errors => pardesDoc(p, from, id), .command => { - const rc = p.ncol - 1; + const rc = p.exec_column orelse p.ncol - 1; if (p.col_n[rc] > 0) belowParent(p, p.col_panes[rc][p.col_n[rc] - 1], id) else layout.insert(p, rc, 0, id); }, } |
