diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 17:24:55 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | 41147087343144a439a77e6b9817f30d596a6fcb (patch) | |
| tree | 35016c5a3b69464ebd95964da6bc9af71adb3262 /src | |
| parent | e626219c9e35b37dece1348f1349c40866871f4c (diff) | |
| download | pardes-41147087343144a439a77e6b9817f30d596a6fcb.tar.gz pardes-41147087343144a439a77e6b9817f30d596a6fcb.zip | |
A pane refused for want of room spends no pane serial, as a refused Newcol spends no column serial
A pane/new, look or exec refused ENOSPC made its pane before placing it.
The refusal closed the pane unannounced, but its serial was gone, so the
next pane skipped one. When sync removes a refused pane that holds the
newest serial, it now puts the counter back.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/ninep/tree.zig | 4 | ||||
| -rw-r--r-- | src/pardes.zig | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 322728da..53d33731 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -1861,6 +1861,10 @@ test "no placement leaves a pane shorter than its tag and two rows; a full colum } else return error.NeverRefused; try testing.expectEqual(E.NOSPC, refused.errno()); try testing.expect(std.mem.indexOf(u8, refused.reply.ename, "no space for a pane in that column") != null); + // The refused pane was never there: no serial spent on it. + const before = p.next_serial; + try testing.expectEqual(E.NOSPC, call(p, .{ .tag = 1, .op = .open, .node = new }).errno()); + try testing.expectEqual(before, p.next_serial); p.sync(); var count: usize = 0; for (p.panes) |slot| count += @intFromBool(slot != null); diff --git a/src/pardes.zig b/src/pardes.zig index 3a6e154a..dc2ec59f 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -6995,7 +6995,13 @@ pub const Pardes = struct { var refused = false; while (p.unplaced.findFirstSet()) |id| { p.unplaced.unset(id); - if (p.panes[id] != null) p.removePane(id, null) catch {}; + if (p.panes[id]) |pane| { + // Refused, it was never there: the serial it took is the + // next pane's, as a refused Newcol's column serial is. + const newest = pane.serial == p.next_serial; + p.removePane(id, null) catch {}; + if (newest and p.panes[id] == null) p.next_serial -= 1; + } refused = true; } // A refused pane gone, no pane it squeezed stays under its minimum. |
