diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 19:16:56 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | 3189900c13b98298776d0da8dcbcb4e0d88858cf (patch) | |
| tree | a4bc0687586a108efe655c9dc9d255ef15260fa6 /src/ninep/cols.zig | |
| parent | 9a256d34ebca317e3007adf71c2b94016059d4a3 (diff) | |
| download | pardes-3189900c13b98298776d0da8dcbcb4e0d88858cf.tar.gz pardes-3189900c13b98298776d0da8dcbcb4e0d88858cf.zip | |
Joincol is refused, as Newcol is, when the joined column cannot give each pane its tag and 2 rows
Joincol moved every pane of the keyboard's column into the next one
whether they fit or not. Two columns of two panes in a 12-row window
became one column of four, wanting 12 rows where 10 were free, a layout
that `size` then refused as it stood. Joincol now tries the join in place
first (layout.joinFits: the panes and width moved, minimaFit asked,
everything put back, nothing dropped or logged). A join that does not
fit is refused, "Joincol: no space: the joined column cannot give each
pane its tag and 2 rows".
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/cols.zig')
| -rw-r--r-- | src/ninep/cols.zig | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index a1fe9ecc..7afcfbd8 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -232,6 +232,32 @@ 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 "Joincol is refused when the joined column cannot give each pane its tag and 2 rows" { + const p = try pardes.Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 12 }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + const ctl = @intFromEnum(tree.TopFile.ctl); + const focus = @intFromEnum(tree.TopFile.focus); + // Two panes in the first column, then a second column of two. + const a = try th.newPane(p); + _ = a; + try testing.expectEqual(tree.Status.ok, th.wr(p, ctl, "Newcol\n").reply.status); + const b = try th.newPane(p); + var digits: [16]u8 = undefined; + _ = th.wr(p, focus, try std.fmt.bufPrint(&digits, "{d}\n", .{b})); + _ = try th.newPane(p); + try testing.expectEqual(@as(usize, 2), p.ncol); + try testing.expect(p.col_n[0] >= 2 and p.col_n[1] >= 2); + // Focus in the left column: joined, four panes want 12 rows of 10. + const left = p.panes[p.col_panes[0][0]].?.serial; + _ = th.wr(p, focus, try std.fmt.bufPrint(&digits, "{d}\n", .{left})); + const r = th.wr(p, ctl, "Joincol\n"); + try testing.expectEqual(tree.Status.err, r.reply.status); + try testing.expect(std.mem.indexOf(u8, r.reply.ename, "tag and 2 rows") != null); + try testing.expectEqual(@as(usize, 2), p.ncol); + try testing.expect(pardes.layout.minimaFit(p)); +} + 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(); |
