summaryrefslogtreecommitdiff
path: root/src/Dir.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Dir.zig')
-rw-r--r--src/Dir.zig16
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);