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/Dir.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/Dir.zig')
| -rw-r--r-- | src/Dir.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Dir.zig b/src/Dir.zig index ae96d816..d8d4d9b0 100644 --- a/src/Dir.zig +++ b/src/Dir.zig @@ -209,7 +209,7 @@ pub fn look(p: *Pardes, from: usize, dir: []const u8) void { exec.placeNew(p, from, from, free, .doc); // Refused a place: that is the look's one failure. if (p.fs.failures != failures) return; - fit(p, pane, @max(1, p.rects[free].w -| config.GUTTER)); + fit(p, pane, @max(1, p.view().rects[free].w -| config.GUTTER)); } /// A pane on directory `name` (ending in `/`) with its entries `names`, @@ -244,7 +244,7 @@ pub fn show(p: *Pardes, from: usize, id: usize) void { refresh(p, id) catch |err| return p.reportError(from, what, err); // Closed while the turn was out: nothing to give the keyboard to. const now = p.panes[id] orelse return; - if (now.serial == serial) p.active = id; + if (now.serial == serial) p.view().active = id; } // ---- tests ---- @@ -360,7 +360,7 @@ test "a look at a directory opens a pane named for it with a /, its entries in c var name_buf: [4200]u8 = undefined; const name = try std.fmt.bufPrint(&name_buf, "{s}/", .{s.dir}); const id = named(p, name).id orelse return error.NoDirectoryPane; - try testing.expectEqual(id, p.active); + try testing.expectEqual(id, p.view().active); const pane = p.panes[id].?; try testing.expectEqualStrings(".dot sub/ top.txt\n", pane.file.?.content); try testing.expectEqualStrings(@import("tagline.zig").dir_pane_tail, @import("tagline.zig").curTail(pane)); @@ -402,7 +402,7 @@ test "a look at an entry is a look from the directory, .. goes up to the open pa p.sync(); const again = named(p, try std.fmt.bufPrint(&name_buf, "{s}/", .{s.dir})); try testing.expectEqual(@as(usize, 1), again.count); - try testing.expectEqual(top, p.active); + try testing.expectEqual(top, p.view().active); try testing.expect(std.mem.indexOf(u8, p.panes[top].?.file.?.content, "new.txt") != null); // Get, in its tag or its text: read again. try tmp.dir.writeFile(testing.io, .{ .sub_path = "sub/later.txt", .data = "" }); @@ -421,7 +421,7 @@ test "an exec in a directory pane runs in its directory, and its +Errors goes th pardes.look.lookAt(p, 0, s.dir); p.sync(); const sub_name = try std.fmt.bufPrint(&name_buf, "{s}/sub/", .{s.dir}); - pardes.look.lookAt(p, p.active, sub_name); + pardes.look.lookAt(p, p.view().active, sub_name); p.sync(); const sub = named(p, sub_name).id.?; try testing.expectEqualStrings(sub_name[0 .. sub_name.len - 1], p.execDir(sub)); @@ -442,7 +442,7 @@ test "over 9P a directory pane is a text pane whose name ends in /, its body the var line_buf: [4200]u8 = undefined; _ = th.wr(p, @backingInt(tree.TopFile.look), try std.fmt.bufPrint(&line_buf, "{s}\n", .{s.dir})); p.sync(); - const pane = p.panes[p.active].?; + const pane = p.panes[p.view().active].?; const index = th.rd(p, @backingInt(tree.TopFile.index), 0, 8192).bytes; try testing.expect(std.mem.indexOf(u8, index, try std.fmt.bufPrint(&line_buf, "{d} text 0 {s}/ ", .{ pane.serial, s.dir })) != null); try testing.expectEqualStrings(".dot sub/ top.txt\n", th.rd(p, tree.Node.of(pane.serial, .body), 0, 4096).bytes); @@ -465,13 +465,13 @@ test "a directory pane lays its entries out again when its width changes, unless const p = s.p; pardes.look.lookAt(p, 0, s.dir); p.sync(); - const pane = p.panes[p.active].?; + const pane = p.panes[p.view().active].?; // 9 cells a column: two of them want 18 cells and the line numbers. fit(p, pane, 24); try testing.expectEqualStrings(".dot top.txt\nsub/\n", pane.file.?.content); fit(p, pane, 80); try testing.expectEqualStrings(".dot sub/ top.txt\n", pane.file.?.content); - try testing.expect(p.executeBuiltinLine(p.active, "Edit 1d")); + try testing.expect(p.executeBuiltinLine(p.view().active, "Edit 1d")); const edited = try testing.allocator.dupe(u8, pane.file.?.content); defer testing.allocator.free(edited); fit(p, pane, 24); |
