diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 02:56:53 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 04:13:33 -0300 |
| commit | d1d5d3cfb18841604bba2057eeb3598f729b4475 (patch) | |
| tree | 298c29ab8767852bf74eb86ad4d15acc4348f109 /src/Store.zig | |
| parent | 33037ece5af9ae1c7048819bbbae3fc5e6fc4ade (diff) | |
| download | pardes-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/Store.zig')
| -rw-r--r-- | src/Store.zig | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/Store.zig b/src/Store.zig index 970fe85e..64a8a7be 100644 --- a/src/Store.zig +++ b/src/Store.zig @@ -120,7 +120,7 @@ pub fn keep(s: *Store, p: *Pardes, id: usize) ?Kept { .column = if (at) |f| layout.columnSerial(p, f.col) else 0, .owner = if (owner) |o| p.panes[o].?.serial else 0, .idx = if (at) |f| f.idx else 0, - .rows = p.rects[id].h, + .rows = p.view().rects[id].h, .name = name, .dump = owned, }; @@ -222,7 +222,7 @@ pub fn reopen(s: *Store, p: *Pardes, serial: u32, from: usize) bool { freeClosed(p.recentGpa(), s.closed.orderedRemove(i)); break; }; - p.active = free; + p.view().active = free; if (layout.findPane(p, free)) |f| p.setActiveColumn(f.col); p.sync(); return true; @@ -268,8 +268,8 @@ test "store: this session keeps its newest 64 closed panes" { var serial: u32 = 0; var text: [16]u8 = undefined; for (0..max_closed + 6) |i| { - p.newScratchBelow(p.active); - const id = p.active; + p.newScratchBelow(p.view().active); + const id = p.view().active; @import("File.zig").setContent(p, &p.panes[id].?.file.?, try p.gpa.dupe(u8, std.fmt.bufPrint(&text, "scratch {d}\n", .{i}) catch unreachable)); serial = p.panes[id].?.serial; // Made outside a step: announced as a step's end would. @@ -278,8 +278,8 @@ test "store: this session keeps its newest 64 closed panes" { } try testing.expectEqual(@as(usize, max_closed), p.store.closed.items.len); try testing.expectEqual(serial, p.store.closed.items[max_closed - 1].serial); - try testing.expect(p.store.reopen(p, serial, p.active)); - try testing.expectEqualStrings("scratch 69\n", p.panes[p.active].?.file.?.content); + try testing.expect(p.store.reopen(p, serial, p.view().active)); + try testing.expectEqualStrings("scratch 69\n", p.panes[p.view().active].?.file.?.content); } test "store: a closed pane comes back where it was, its rows from the pane that took them, nothing else moving; Panes lists it, marked" { @@ -291,36 +291,36 @@ test "store: a closed pane comes back where it was, its rows from the pane that defer p.deinit(); _ = try p.setTestFile("alpha\nbeta\n"); p.newScratchBelow(0); - const sid = p.active; + const sid = p.view().active; @import("File.zig").setContent(p, &p.panes[sid].?.file.?, try p.gpa.dupe(u8, "kept text\n")); p.newScratchBelow(0); - try testing.expect(layout.splitColumn(p, p.active, p.active, false)); - const far = p.active; - p.active = 0; + try testing.expect(layout.splitColumn(p, p.view().active, p.view().active, false)); + const far = p.view().active; + p.view().active = 0; // Made outside a step: announced as a step's end would. pardes.ctlfs.events.announce(p); layout.compute(p); - const before = p.rects; + const before = p.view().rects; const serial = p.panes[sid].?.serial; try p.removePane(sid, null); layout.compute(p); - try testing.expectEqualDeep(before[far], p.rects[far]); + try testing.expectEqualDeep(before[far], p.view().rects[far]); try testing.expect(p.store.reopen(p, serial, 0)); - const back = p.active; + const back = p.view().active; layout.compute(p); try testing.expectEqualStrings("kept text\n", p.panes[back].?.file.?.content); try testing.expect(p.panes[back].?.serial != serial); // Its rect as it was, the one above as it was, the other column's // untouched: its rows came from the pane that took them alone. - try testing.expectEqualDeep(before[sid], p.rects[back]); - try testing.expectEqualDeep(before[0], p.rects[0]); - try testing.expectEqualDeep(before[far], p.rects[far]); + try testing.expectEqualDeep(before[sid], p.view().rects[back]); + try testing.expectEqualDeep(before[0], p.view().rects[0]); + try testing.expectEqualDeep(before[far], p.view().rects[far]); try testing.expect(p.store.closedBySerial(serial) == null); // Closed again: Panes lists it after the open ones, `(closed)`. const again = p.panes[back].?.serial; pardes.ctlfs.events.announce(p); try p.removePane(back, null); - p.active = 0; + p.view().active = 0; p.update(.{ .key = .{ .cp = ' ', .text = " " } }); for ("bb") |ch| p.update(.{ .key = .{ .cp = ch, .text = &.{ch} } }); const qid = for (p.panes, 0..) |slot, i| { |
