From 50914b0e04ac0129b11bff0f0007d5cedbfc7f8d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 20:39:55 -0300 Subject: fields #37, a column is one Column: the four parallel arrays a column's own state was kept in (col_panes, col_n, col_weight, col_serial) are the session's cols: [MAX_COLS]Column, a struct of panes, n, weight and serial (acme's Column, cols.c), so a column shifted, saved or reset is one assignment where it was four (layout.reorderColumn, dropColumn, insertColumn, firstColumn, joinFits, Finder.open; joinFits and the resets now give back a column's panes beyond its count too, which nothing reads); its tag stays the session's col_tags, as a view opened takes the live one's columns but tags of its own (views.open), and col_x and col_w stay with the rects, worked out each sync; the uses in 20 files read p.cols[c].n for p.col_n[c] and so on, tests that compared the arrays whole compare the columns whole (or their weights, layout.zig's weightsOf); views.zig's per-view fields name cols; a dump written before this change loads its columns as the default once: an Upgrade or Restore from it comes back with its columns empty and its panes in none of them, and the wire's semantics change (the digest walks cols); dump.zig and Handover.zig, the persistence agent's, are edited only where they name these fields; gates on tui: core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), snap all 108 scripts ok; gui unit-test 1518/1519 (1 skipped) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/panes.zig | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/panes.zig') 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); -- cgit v1.3