diff options
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/cols.zig | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index 9185a2bc..c4ee83eb 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -228,6 +228,27 @@ test "New written to a column's exec makes its scratch in the session's director try testing.expectEqualStrings("/project/src/+New", p.panes[p.active].?.file.?.path); } +test "pane/new takes rows from a pane in another column before refusing ENOSPC" { + const p = try pardes.Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 16 }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + const first = p.panes[p.active].?.serial; + // A second column holding one tall pane. + try testing.expectEqual(tree.Status.ok, th.wr(p, @intFromEnum(tree.TopFile.ctl), "Newcol\n").reply.status); + const tall = try th.newPane(p); + const tall_col = layout.findPane(p, p.paneBySerial(tall).?).?.col; + const focus = @intFromEnum(tree.TopFile.focus); + var digits: [16]u8 = undefined; + // From the first column, until pane/new is refused. + var moved = false; + for (0..pardes.MAX_PANES) |_| { + _ = th.wr(p, focus, try std.fmt.bufPrint(&digits, "{d}\n", .{first})); + const made = th.newPane(p) catch break; + if (layout.findPane(p, p.paneBySerial(made).?).?.col == tall_col) moved = true; + } + try testing.expect(moved); +} + test "a Newcol refused because the tags would not fit logs its err alone and spends no column serial" { const p = try pardes.Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 14 }); defer p.deinit(); |
