From f65cb652243bf0a63eecdd4d6c5cd8ccbc3fd2ea Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 18:04:25 -0300 Subject: Under pardes's placement a pane whose neighbour is in no column goes at a column's foot, not nowhere After Delcol took the last column's panes, pane/new under Placement made a scratch that no column held, since a scratch was placed only under the asking pane, which was gone; a look from it then unwrapped the missing parent in belowParent and panicked (the 9P monkey's crash-e1873f34). Both now fall back to the foot of the active column, else the last. Co-Authored-By: Claude Opus 5.5 --- src/exec.zig | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/exec.zig') 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].?); } -- cgit v1.3