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/ninep/tree.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/ninep/tree.zig')
| -rw-r--r-- | src/ninep/tree.zig | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 4f155b4f..d15ddd53 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -690,8 +690,8 @@ fn topSize(p: *Pardes, f: TopFile) u64 { .ctl => if (ctl.settingsText(p)) |text| text.len else |_| 0, .commands => if (ctl.commandsText(p)) |text| text.len else |_| 0, .focus => focus: { - if (p.header != null) break :focus 0; - const pn = p.panes[p.active] orelse break :focus 0; + if (p.view().header != null) break :focus 0; + const pn = p.panes[p.view().active] orelse break :focus 0; var digits: [16]u8 = undefined; // unreachable: a u32 serial and a newline fit 16 break :focus (std.fmt.bufPrint(&digits, "{d}\n", .{pn.serial}) catch unreachable).len; @@ -784,7 +784,7 @@ fn readdir(p: *Pardes, req: Req, target: Target) Reply { stageDirent(out, p.gpa, Node.of(serial, .dir), true, name); } }, - .col => for (0..p.ncol) |c| { + .col => for (0..p.view().ncol) |c| { if (skip > 0) { skip -= 1; continue; @@ -841,7 +841,7 @@ fn open(p: *Pardes, req: Req, target: Target) Reply { // Refused, the open's err is the one record of it (the // one rule): no msg besides. p.fs.capturing = true; - panes.newScratchFor(p, p.active, .fs); + panes.newScratchFor(p, p.view().active, .fs); p.fs.capturing = false; p.fs.failure_len = 0; const made = p.panes[slot] orelse return Reply.fail(req.tag, E.NFILE); @@ -1438,7 +1438,7 @@ test "filesystem inspection preserves pending and displayed Look hover" { var frame: std.heap.ArenaAllocator = .init(gpa); defer frame.deinit(); _ = try p.render(frame.allocator()); - const rect = p.rects[0]; + const rect = p.view().rects[0]; p.update(.{ .mouse = .{ .button = .none, .kind = .motion, @@ -1473,13 +1473,13 @@ test "filesystem inspection preserves pending and displayed Look hover" { try testing.expectEqual(Status.ok, answer.reply.status); try testing.expect(std.meta.eql(waiting, p.look_hover_wait)); try testing.expect(std.meta.eql(preview, p.look_hover_preview)); - try testing.expect(p.raw_hover_intent); + try testing.expect(p.view().raw_hover_intent); } } try testing.expectEqual(Status.ok, wr(p, body, "changed").reply.status); try testing.expect(p.look_hover_wait == null); try testing.expect(p.look_hover_preview == null); - try testing.expect(!p.raw_hover_intent); + try testing.expect(!p.view().raw_hover_intent); } test "log stats 0 however much it holds, a stream as acme's generated files are" { @@ -1501,13 +1501,13 @@ test "filesystem pane creation and truncation cancel Look hover" { const p = try withFile(testing.allocator, "word\n"); defer p.deinit(); p.look_hover_wait = .{ .col = 1, .row = 1, .pane = 0, .serial = serialOf(p) }; - p.raw_hover_intent = true; + p.view().raw_hover_intent = true; var req = request; if (req.op == .setattr) req.node = Node.of(serialOf(p), .body); try testing.expectEqual(Status.ok, call(p, req).reply.status); try testing.expect(p.look_hover_wait == null); try testing.expect(p.look_hover_preview == null); - try testing.expect(!p.raw_hover_intent); + try testing.expect(!p.view().raw_hover_intent); } } @@ -1839,9 +1839,9 @@ test "random placements, refused or not, leave no pane under its tag and two row 6 => _ = th.wr(p, Node.of(at, .exec), "Delcol\n"), else => _ = th.wr(p, Node.of(at, .ctl), "delete\n"), } - for (0..p.ncol) |c| if (!layout.columnAtMinimums(p, c)) { + for (0..p.view().ncol) |c| if (!layout.columnAtMinimums(p, c)) { std.debug.print("seed {d} rows {d} step {d} action {d}: column {d} under its minimums\n", .{ seed, rows, step, action, c }); - for (p.cols[c].panes[0..p.cols[c].n]) |id| std.debug.print(" pane {d} h {d} min {d}\n", .{ id, p.rects[id].h, layout.minRows(p, id) }); + for (p.view().cols[c].panes[0..p.view().cols[c].n]) |id| std.debug.print(" pane {d} h {d} min {d}\n", .{ id, p.view().rects[id].h, layout.minRows(p, id) }); return error.TestUnexpectedResult; }; } @@ -1997,14 +1997,14 @@ test "look and exec read back what their own open's write touched; a fresh open const mine = call(p, .{ .tag = 1, .op = .open, .node = exec, .omode = 2 }).reply.handle; const theirs = call(p, .{ .tag = 2, .op = .open, .node = exec, .omode = 2 }).reply.handle; _ = call(p, .{ .tag = 3, .op = .write, .node = exec, .handle = mine, .data = "Term\n" }); - const made = p.panes[p.active].?.serial; + const made = p.panes[p.view().active].?.serial; try testing.expect(made != first); _ = call(p, .{ .tag = 4, .op = .write, .node = exec, .handle = theirs, .data = "Msg hi\n" }); var want: [16]u8 = undefined; // Read at the offset the write left, as a shell's `exec 3<>` does. try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), call(p, .{ .tag = 5, .op = .read, .node = exec, .handle = mine, .off = 4, .size = 64 }).bytes); try testing.expectEqualStrings("", call(p, .{ .tag = 6, .op = .read, .node = exec, .handle = mine, .off = 4, .size = 64 }).bytes); - const said = p.panes[p.active].?.serial; + const said = p.panes[p.view().active].?.serial; try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{said}), call(p, .{ .tag = 7, .op = .read, .node = exec, .handle = theirs, .size = 64 }).bytes); const fresh = call(p, .{ .tag = 8, .op = .open, .node = exec }).reply.handle; try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{said}), call(p, .{ .tag = 9, .op = .read, .node = exec, .handle = fresh, .size = 64 }).bytes); @@ -2061,9 +2061,9 @@ test "no placement leaves a pane shorter than its tag and two rows; a full colum var count: usize = 0; for (p.panes) |slot| count += @intFromBool(slot != null); try testing.expectEqual(made, count); // the refused one is gone - for (0..p.ncol) |c| for (p.cols[c].panes[0..p.cols[c].n]) |k| { - if (p.cols[c].n > 1 and !p.panes[k].?.collapsed) - try testing.expect(p.rects[k].h >= p.panes[k].?.tag_rows + pardes.layout.min_body_rows); + for (0..p.view().ncol) |c| for (p.view().cols[c].panes[0..p.view().cols[c].n]) |k| { + if (p.view().cols[c].n > 1 and !p.panes[k].?.collapsed) + try testing.expect(p.view().rects[k].h >= p.panes[k].?.tag_rows + pardes.layout.min_body_rows); }; } @@ -2111,6 +2111,6 @@ test "a pane made from pane/new goes last in its column, even when the last pane for (0..3) |_| { const made = call(p, .{ .tag = 1, .op = .open, .node = @backingInt(TopFile.new) }).reply.handle; p.sync(); - try testing.expectEqual(made, p.panes[p.cols[0].panes[p.cols[0].n - 1]].?.serial); + try testing.expectEqual(made, p.panes[p.view().cols[0].panes[p.view().cols[0].n - 1]].?.serial); } } |
