summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 02:56:53 -0300
committerGabriel Schneider <[email protected]>2026-11-06 04:13:33 -0300
commitd1d5d3cfb18841604bba2057eeb3598f729b4475 (patch)
tree298c29ab8767852bf74eb86ad4d15acc4348f109 /src/pardes.zig
parent33037ece5af9ae1c7048819bbbae3fc5e6fc4ade (diff)
downloadpardes-d1d5d3cfb18841604bba2057eeb3598f729b4475.tar.gz
pardes-d1d5d3cfb18841604bba2057eeb3598f729b4475.zip
client #1, the views indexed: a view's share of the session is Pardes.View (the ~42 fields views.fields named: size, cell metrics, columns, rects, focus, jumps, pointer, gestures, prefixes, frontend), one of Pardes.views[4] (null when closed), the live one views[live] through Pardes.view() (index field `view` renamed `live`); going into another view is the index plus the panes' shares, which stay swapped (park and unpark now move only Pane.pv); views.zig loses fields, Part over Pardes, Parked, kept, emptied and the session half of every copy, and a pane closing leaves every view's layout at once (views.gone, at the two places a slot is freed) instead of the serials each parked view kept; drawOne and within put the drawn view's own share back whole; the views are in the digest now (tape's per-field parts name views[k].field), so a fresh view's col_x/col_w default to zeros, not undefined; the dump keeps every open view in the core and the panes' shares of the others under `shares`; an image from before (live view as the core's own fields, the rest under `views`) loads them into views[] once; the ~2,400 references rewritten mechanically from the compiler's errors (p.active is p.view().active, `const v = p.view()` hoisted in 823 places), Kind.zig (4 lines) and addon_test.zig (3) among them, macos.zig by pattern (not compiled here); tape's watched host writes read the live view's frontend and active; perf.zig's accessor lines change its harness hash, the debug baselines re-keyed to it (their numbers the base's); no golden changes; gates: core-test 956/956 both, unit-test 1487/1488 tui and 1530/1531 gui, behaviour-test 248/248 both, pane-test 171/172, snap all 105 ok, process-test 0 of 37 failed tui, replicas ok
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 940e5c5d..35cccf26 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -158,14 +158,15 @@ pub const BOX_H: u16 = 1;
pub const TAG_TEXT_INSET: u16 = config.GUTTER;
pub fn taglineOriginCol(p: *const Pardes, col: u16, row: u16) f32 {
+ const v = p.view();
if (row < p.topBarHeight()) return 0;
if (row < p.topBarHeight() + layout.columnBarHeight(p)) {
- for (p.col_x[0..p.ncol], p.col_w[0..p.ncol]) |x, w|
+ for (v.col_x[0..p.view().ncol], v.col_w[0..p.view().ncol]) |x, w|
if (col >= x and col - x < w) return @floatFromInt(x);
}
for (p.panes, 0..) |slot, id| {
const pane = slot orelse continue;
- const r = p.rects[id];
+ const r = v.rects[id];
const tag_y = p.tagTop(pane, r);
if (row >= tag_y and row < tag_y + pane.tag_rows and col >= r.x and col < r.x + r.w) return @floatFromInt(r.x);
}
@@ -177,7 +178,7 @@ pub fn gridColAt(p: ?*const Pardes, x: f32, row: u16, body_w: f32, tagline_w: f3
const tag = @max(tagline_w, 1);
if (row < (if (p) |core| core.topBarHeight() else TOPBAR_H)) return colFromSpan(x, tag);
if (p) |core| if (row < core.topBarHeight() + layout.columnBarHeight(core)) {
- for (core.col_x[0..core.ncol], core.col_w[0..core.ncol]) |origin, width| {
+ for (core.view().col_x[0..core.view().ncol], core.view().col_w[0..core.view().ncol]) |origin, width| {
if (width == 0) continue;
const left = @as(f32, @floatFromInt(origin)) * body;
const right = @as(f32, @floatFromInt(origin + width)) * body;
@@ -190,7 +191,7 @@ pub fn gridColAt(p: ?*const Pardes, x: f32, row: u16, body_w: f32, tagline_w: f3
};
if (p) |core| for (core.panes, 0..) |slot, id| {
const pane = slot orelse continue;
- const r = core.rects[id];
+ const r = core.view().rects[id];
const tag_y = core.tagTop(pane, r);
if (row < tag_y or row >= tag_y + pane.tag_rows or r.w == 0) continue;
const left = @as(f32, @floatFromInt(r.x)) * body;
@@ -218,8 +219,8 @@ test "a compact tagline anchors at its own pane, and both shells step from the s
// Two panes side by side put two tags on ONE row, which is the case a
// per-row origin gets wrong and the reason this is asked per cell.
- const left = p.rects[0];
- const right = p.rects[1];
+ const left = p.view().rects[0];
+ const right = p.view().rects[1];
try std.testing.expect(right.x > left.x);
try std.testing.expectEqual(@as(f32, @floatFromInt(left.x)), taglineOriginCol(p, left.x + 3, left.y));
try std.testing.expectEqual(@as(f32, @floatFromInt(right.x)), taglineOriginCol(p, right.x + 3, right.y));
@@ -233,7 +234,7 @@ test "a compact tagline anchors at its own pane, and both shells step from the s
const body_w: f32 = 10;
const tag_w: f32 = 8;
- for (p.col_x[0..p.ncol], p.col_w[0..p.ncol]) |origin, width| {
+ for (p.view().col_x[0..p.view().ncol], p.view().col_w[0..p.view().ncol]) |origin, width| {
if (width == 0) continue;
const col = origin;
try std.testing.expectEqual(@as(f32, @floatFromInt(origin)), taglineOriginCol(p, col, TOPBAR_H));