summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/exec.zig b/src/exec.zig
index 87f6da40..2c42389c 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -1150,7 +1150,7 @@ fn pardesPlace(p: *Pardes, from: usize, id: usize, kind: NewPane) void {
.scratch, .fs => if (layout.findPane(p, from)) |sf| {
layout.insert(p, sf.col, sf.idx + 1, id);
layout.splitBelow(p, from, nt);
- },
+ } else atFoot(p, id),
.shell => belowParent(p, from, id),
.doc, .errors => pardesDoc(p, from, id),
.command => {
@@ -1160,9 +1160,18 @@ fn pardesPlace(p: *Pardes, from: usize, id: usize, kind: NewPane) void {
}
}
+/// Where a pane goes when the one it would go under is in no column (Delcol
+/// took them all, or it was never placed): the foot of the active column,
+/// else of the last.
+fn atFoot(p: *Pardes, id: usize) void {
+ const c = p.activeColumn() orelse p.ncol - 1;
+ layout.insert(p, c, p.col_n[c], id);
+ if (p.col_n[c] == 1) p.panes[id].?.vweight = 1;
+}
+
fn belowParent(p: *Pardes, from: usize, id: usize) void {
const parent = layout.splitParent(p, from);
- const f = layout.findPane(p, parent).?;
+ const f = layout.findPane(p, parent) orelse return atFoot(p, id);
layout.insert(p, f.col, f.idx + 1, id);
layout.splitBelow(p, parent, p.panes[id].?);
}