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