summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ninep/tree.zig4
-rw-r--r--src/pardes.zig8
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.