From 4881c5d13c6a705a8c8bdb0181c33f9a500b5a74 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 00:23:55 -0300 Subject: Columns are named by stable serials over 9P, as panes are /col/ named a column by its index, which shifts when a column left of it closes: exactly what scripts trip on. A column is now /col/, its serial kept while it lives and never reused; /layout lines give serial and index (` ...`), active names the serial, /index's last field is the column's serial, and the log says newcol and delcol with serials. Docs, the skill and the tree's README say so. Co-Authored-By: Claude Opus 5.5 --- src/layout.zig | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/layout.zig') diff --git a/src/layout.zig b/src/layout.zig index 25c95d30..b9b24e79 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -322,6 +322,7 @@ pub fn removePane(p: *Pardes, id: usize) void { /// it (the first column's to its right), as acme's rowclose gives it. pub fn dropColumn(p: *Pardes, c: usize) void { std.debug.assert(p.col_n[c] == 0); + const serial = columnSerial(p, c); tagline.exitHeader(p); if (p.ncol > 1) p.col_weight[if (c > 0) c - 1 else c + 1] +|= p.col_weight[c]; p.col_tags[c].deinit(p.gpa); @@ -336,14 +337,14 @@ pub fn dropColumn(p: *Pardes, c: usize) void { p.ncol -= 1; p.col_tags[p.ncol] = .{ .what = .column, .gpa = p.gpa }; p.col_serial[p.ncol] = 0; - noteColumn(p, "delcol", c); + noteColumn(p, "delcol", serial); } -/// `newcol ` or `delcol ` in the log: the index, as /layout and -/// /col number columns, the ones after it moving up or down one. -fn noteColumn(p: *Pardes, what: []const u8, c: usize) void { +/// `newcol ` or `delcol ` in the log: the column's serial, +/// as /layout and /col name it. +fn noteColumn(p: *Pardes, what: []const u8, serial: u32) void { var buf: [16]u8 = undefined; - pardes.ctlfs.events.notePath(p, what, std.fmt.bufPrint(&buf, "{d}", .{c}) catch return); + pardes.ctlfs.events.notePath(p, what, std.fmt.bufPrint(&buf, "{d}", .{serial}) catch return); } /// Fold column `c` into the one on its right, its panes below theirs. @@ -499,7 +500,7 @@ pub fn insertColumn(p: *Pardes, col: usize, before: bool) ?usize { p.col_serial[c] = 0; p.col_n[c] = 0; p.ncol += 1; - noteColumn(p, "newcol", c); + noteColumn(p, "newcol", columnSerial(p, c)); return c; } -- cgit v1.3