diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 00:01:04 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 64b6a0dbdaab4b314ccbce667709d71a8561daf0 (patch) | |
| tree | ceb955449a4458675e7d3bccca4565bd469039da /src/layout.zig | |
| parent | b71a9051006f88052d240e521046428c4e1c5e15 (diff) | |
| download | pardes-64b6a0dbdaab4b314ccbce667709d71a8561daf0.tar.gz pardes-64b6a0dbdaab4b314ccbce667709d71a8561daf0.zip | |
The tree serves the layout: /layout, /tag and /col/<n>/tag
A script could not see where the panes sit or edit the tags a person
clicks in. /layout lists each column, its index, x and width in cells,
current or not, empty or full, and its panes' serials, then the active
column; /tag is the workspace tag and /col/<n>/tag a column's, read and
written as a pane tag is (one line: a newline written in is a space, and a
truncating write drops the one ending it); /index's lines end with the
pane's column; the log says newcol <n> and delcol <n>. acme serves no
column files, and the docs say so.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/layout.zig')
| -rw-r--r-- | src/layout.zig | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/layout.zig b/src/layout.zig index c58f3bcf..6de7a912 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -280,7 +280,7 @@ pub fn applyRowSplit(p: *Pardes, cc: usize, k: usize, cur_y: u16) void { b.vweight = pair - a.vweight; } -pub fn findPane(p: *Pardes, id: usize) ?struct { col: usize, idx: usize } { +pub fn findPane(p: *const Pardes, id: usize) ?struct { col: usize, idx: usize } { for (0..p.ncol) |c| { for (0..p.col_n[c]) |k| { if (p.col_panes[c][k] == id) return .{ .col = c, .idx = k }; @@ -325,6 +325,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); +} + +/// `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 { + var buf: [16]u8 = undefined; + pardes.ctlfs.events.notePath(p, what, std.fmt.bufPrint(&buf, "{d}", .{c}) catch return); } /// Fold column `c` into the one on its right, its panes below theirs. @@ -480,6 +488,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); return c; } |
