diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 00:23:55 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 4881c5d13c6a705a8c8bdb0181c33f9a500b5a74 (patch) | |
| tree | 31ee1398657b271d08830a1efad9e6d9f206aa68 /src/layout.zig | |
| parent | 15ddd805905f785f4dde463d4d6b91e1d2c41e26 (diff) | |
| download | pardes-4881c5d13c6a705a8c8bdb0181c33f9a500b5a74.tar.gz pardes-4881c5d13c6a705a8c8bdb0181c33f9a500b5a74.zip | |
Columns are named by stable serials over 9P, as panes are
/col/<n> 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/<serial>, its
serial kept while it lives and never reused; /layout lines give serial and
index (`<serial> <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 <[email protected]>
Diffstat (limited to 'src/layout.zig')
| -rw-r--r-- | src/layout.zig | 13 |
1 files changed, 7 insertions, 6 deletions
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 <n>` or `delcol <n>` 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 <serial>` or `delcol <serial>` 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; } |
