summaryrefslogtreecommitdiff
path: root/src/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/panes.zig')
-rw-r--r--src/panes.zig18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/panes.zig b/src/panes.zig
index 94c9615f..4f7ca0e7 100644
--- a/src/panes.zig
+++ b/src/panes.zig
@@ -1025,7 +1025,7 @@ pub fn removePane(p: *Pardes, id: usize, to: ?usize) error{OutOfMemory}!void {
// An attachment's rows go back to its owner and nobody else.
const owner = layout.ownerOf(p, id);
const place = layout.findPane(p, id);
- const emptied = if (place) |f| (if (p.col_n[f.col] == 1) f.col else null) else null;
+ const emptied = if (place) |f| (if (p.cols[f.col].n == 1) f.col else null) else null;
// What it was and where, for Panes to bring back (Store.zig).
const kept = p.store.keep(p, id);
errdefer if (kept) |k| k.free(p.recentGpa());
@@ -1054,8 +1054,8 @@ pub fn removePane(p: *Pardes, id: usize, to: ?usize) error{OutOfMemory}!void {
/// the jumplist, and alternating with it is exactly what Last is for.
pub fn neighbourPane(p: *Pardes, from: usize) ?usize {
if (layout.findPane(p, from)) |at| {
- const n = p.col_n[at.col];
- if (n > 1) return p.col_panes[at.col][(at.idx + 1) % n];
+ const n = p.cols[at.col].n;
+ if (n > 1) return p.cols[at.col].panes[(at.idx + 1) % n];
}
for (p.panes, 0..) |slot, id| {
if (slot != null and id != from) return id;
@@ -1213,8 +1213,7 @@ test "owned cwd close copies are transactional across inherited chains" {
while (p.nextEffect()) |_| {}
p.parkPendingWrite(0, "queued");
const pending = p.pending_write[0].?.bytes;
- const columns = p.col_panes;
- const counts = p.col_n;
+ const columns = p.cols;
const active = p.active;
const live_bytes = allocator.allocated_bytes - allocator.freed_bytes;
allocator.fail_index = allocator.alloc_index + failed_copy;
@@ -1223,8 +1222,7 @@ test "owned cwd close copies are transactional across inherited chains" {
try std.testing.expectEqual(parent, first.cwd.inherited);
try std.testing.expectEqual(parent, second.cwd.inherited);
try std.testing.expectEqual(first, grandchild.cwd.inherited);
- try std.testing.expectEqualDeep(columns, p.col_panes);
- try std.testing.expectEqualDeep(counts, p.col_n);
+ try std.testing.expectEqualDeep(columns, p.cols);
try std.testing.expectEqual(active, p.active);
try std.testing.expectEqual(@as(usize, 0), p.effects_len);
try std.testing.expectEqual(pending.ptr, p.pending_write[0].?.bytes.ptr);
@@ -1257,13 +1255,11 @@ test "owned cwd column close allocates every copy before removing any pane" {
second_child.cwd = .{ .inherited = p.panes[1].? };
while (p.nextEffect()) |_| {}
const before = p.panes;
- const columns = p.col_panes;
- const counts = p.col_n;
+ const columns = p.cols;
allocator.fail_index = allocator.alloc_index + 1;
try std.testing.expectError(error.OutOfMemory, layout.removeColumn(p, 0));
for (before, p.panes) |old, current| try std.testing.expectEqual(old, current);
- try std.testing.expectEqualDeep(columns, p.col_panes);
- try std.testing.expectEqualDeep(counts, p.col_n);
+ try std.testing.expectEqualDeep(columns, p.cols);
try std.testing.expectEqual(@as(usize, 0), p.effects_len);
try std.testing.expect(first_child.cwd == .inherited and second_child.cwd == .inherited);
allocator.fail_index = std.math.maxInt(usize);