From 23d7f949b8595ed42e938a28b0d433d90853b341 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 13:30:40 -0300 Subject: A Newcol refused because the panes' tags would not fit logs its err alone and spends no column serial Newcol tries its column before keeping it: the new column is inserted, the panes' rows are shared out again, and where a pane would be left under its tag and two rows the column is taken back. The trial showed. insertColumn logged `newcol N` and the take-back `delcol N`, so a follower saw a column come and go around the err. Laying the column out also gave it a serial, so the next column made skipped one. The trial is now unannounced, since insert and drop have unlogged forms. A refusal puts the serial counter back where it was, after first giving every existing column its serial so the trial's is the only one spent. Only a column that stays is logged, and it gets the next serial. Co-Authored-By: Claude Opus 5.5 --- src/pardes.zig | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/pardes.zig') diff --git a/src/pardes.zig b/src/pardes.zig index f0d22d57..f61ba797 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -4971,8 +4971,13 @@ pub const Pardes = struct { // An empty window (Delcol took the last column): its first column. if (layout.firstColumn(p)) |c| return tagline.enterHeader(p, c); const col = p.keyboardColumn(from_id) orelse return; + // A trial: laying it out gives it a serial (layout.compute), which a + // refusal takes back. Every other column has its own already, so + // the counter as it is now is the trial's to return to. + for (0..p.ncol) |k| _ = layout.columnSerial(p, k); + const unspent = p.next_column_serial; // Said, not silently nothing: "no space" is 9ns's word for ENOSPC. - const c = layout.insertColumn(p, col, false) orelse { + const c = layout.insertColumnUnannounced(p, col, false) orelse { var said: [96]u8 = undefined; return p.reportFailure(from_id, if (p.ncol >= MAX_COLS) std.fmt.bufPrint(&said, "Newcol: no space for a column: {d} max", .{MAX_COLS}) catch "Newcol: no space for a column" @@ -4984,10 +4989,13 @@ pub const Pardes = struct { // out again, and where they cannot hold every minimum there is no // new column, as a size too small is refused. for (0..p.ncol) |k| if (!layout.columnAtMinimums(p, k) and !layout.shareColumn(p, k)) { - layout.dropColumn(p, c); + layout.dropColumnUnannounced(p, c); + p.next_column_serial = unspent; layout.compute(p); return p.reportFailure(from_id, "Newcol: no space for a column: the panes' tags would not fit"); }; + // Kept: now it has a serial, and the log hears of it. + layout.noteColumn(p, "newcol", layout.columnSerial(p, c)); tagline.enterHeader(p, c); } -- cgit v1.3