From 073695995ecf4a269da8d338b23bfab1d3369c05 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 03:11:42 -0300 Subject: +Errors with no room anywhere logs its text rather than fail the Edit Edit's p and = put their output in +Errors, and when its column had no room the placement refusal failed the whole Edit. +Errors now tries every column with room, the last first, and with none its text is logged as msg records, a line each; the Edit succeeds. Co-Authored-By: Claude Opus 5.5 --- src/exec.zig | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/exec.zig') diff --git a/src/exec.zig b/src/exec.zig index 0a7e71f9..bb4309a4 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -851,9 +851,32 @@ pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPan layout.snapColWeights(p, f.col); if (!layout.splitTallest(p, f.col, id) or !layout.placedRoomy(p, id, &before)) { if (layout.findPane(p, id) == null) layout.insert(p, f.col, p.col_n[f.col], id); - p.unplaced.set(id); - p.reportError(from, "placement", error.NoPaneRoom); - return; + // +Errors goes wherever there is room, last column first; with + // none, its maker says the text some other way (appendErrors). + if (kind == .errors) { + layout.removePane(p, id); + var c = p.ncol; + while (c > 0) { + c -= 1; + if (c == f.col) continue; + for (p.col_panes[c][0..p.col_n[c]]) |k| p.rects[k] = before[k]; + layout.snapColWeights(p, c); + if (p.col_n[c] == 0) { + layout.insert(p, c, 0, id); + break; + } + if (layout.splitTallest(p, c, id) and layout.placedRoomy(p, id, &before)) break; + if (layout.findPane(p, id) != null) layout.removePane(p, id); + } else { + layout.insert(p, f.col, p.col_n[f.col], id); + p.unplaced.set(id); + return; + } + } else { + p.unplaced.set(id); + p.reportError(from, "placement", error.NoPaneRoom); + return; + } } }; if (kind == .command) return; -- cgit v1.3