summaryrefslogtreecommitdiff
path: root/src/ninep/cols.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/cols.zig')
-rw-r--r--src/ninep/cols.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig
index 60071bd0..3a7f0dbb 100644
--- a/src/ninep/cols.zig
+++ b/src/ninep/cols.zig
@@ -36,9 +36,9 @@ pub fn writeLayout(p: *Pardes, w: *std.Io.Writer) !void {
for (0..p.ncol) |c| {
try w.print("{d} {d} {d} {d} {s} {s}", .{
layout.columnSerial(p, c), c, p.col_x[c], p.col_w[c],
- if (active == c) "current" else "notcurrent", if (p.col_n[c] == 0) "empty" else "full",
+ if (active == c) "current" else "notcurrent", if (p.cols[c].n == 0) "empty" else "full",
});
- for (p.col_panes[c][0..p.col_n[c]]) |id| if (p.panes[id]) |pane| try w.print(" {d}", .{pane.serial});
+ for (p.cols[c].panes[0..p.cols[c].n]) |id| if (p.panes[id]) |pane| try w.print(" {d}", .{pane.serial});
try w.writeByte('\n');
}
if (layout.activeColumn(p) orelse active) |c| try w.print("active {d}\n", .{layout.columnSerial(p, c)}) else try w.writeAll("active -\n");
@@ -238,9 +238,9 @@ test "Joincol is refused when the joined column cannot give each pane its tag an
_ = th.wr(p, focus, try std.fmt.bufPrint(&digits, "{d}\n", .{b}));
_ = try th.newPane(p);
try testing.expectEqual(@as(usize, 2), p.ncol);
- try testing.expect(p.col_n[0] >= 2 and p.col_n[1] >= 2);
+ try testing.expect(p.cols[0].n >= 2 and p.cols[1].n >= 2);
// Focus in the left column: joined, four panes want 12 rows of 10.
- const left = p.panes[p.col_panes[0][0]].?.serial;
+ const left = p.panes[p.cols[0].panes[0]].?.serial;
_ = th.wr(p, focus, try std.fmt.bufPrint(&digits, "{d}\n", .{left}));
const r = th.wr(p, ctl, "Joincol\n");
try testing.expectEqual(tree.Status.err, r.reply.status);
@@ -311,12 +311,12 @@ test "a Newcol refused because the tags would not fit logs its err alone and spe
const made = try th.newPane(p);
const pane = p.panes[p.paneBySerial(made).?].?;
const col = layout.findPane(p, p.paneBySerial(made).?).?.col;
- for (p.col_panes[col][0..p.col_n[col]]) |k| {
+ for (p.cols[col].panes[0..p.cols[col].n]) |k| {
const each = p.panes[k].?;
if (each.tag.own) |old| p.gpa.free(old);
each.tag.own = try p.gpa.dupe(u8, std.mem.asBytes(&@as([60][5]u8, @splat("word ".*))));
}
- try testing.expect(p.col_n[col] >= 2);
+ try testing.expect(p.cols[col].n >= 2);
p.sync();
const ctl = @backingInt(tree.TopFile.ctl);
const focus = @backingInt(tree.TopFile.focus);
@@ -450,7 +450,7 @@ test "New and Term run at /tagexec and a column's exec, with no pane at all too"
// Every pane gone: the workspace tag makes one all the same.
for ([_][]const u8{ "New\n", "Term\n" }) |line| {
while (p.ncol > 0) {
- const first = p.panes[p.col_panes[0][0]].?.serial;
+ const first = p.panes[p.cols[0].panes[0]].?.serial;
_ = th.wr(p, tree.Node.of(first, .ctl), "delete\n");
if (panes.anyPane(p) == null) break;
}
@@ -495,7 +495,7 @@ test "every pane word a tag no pane owns does not hold is refused there, Edit in
pub fn remove(p: *Pardes, req: Req, serial: u32, file: tree.ColFile) Reply {
if (file != .dir) return Reply.fail(req.tag, E.PERM);
const col = layout.columnBySerial(p, serial) orelse return Reply.fail(req.tag, E.NOENT);
- if (p.col_n[col] > 0) return tree.failText(req.tag, E.NOTEMPTY, "column not empty: close its panes, or write Delcol to its ctl");
+ if (p.cols[col].n > 0) return tree.failText(req.tag, E.NOTEMPTY, "column not empty: close its panes, or write Delcol to its ctl");
layout.removeColumn(p, col) catch return Reply.fail(req.tag, E.IO);
return .{ .tag = req.tag };
}
@@ -617,7 +617,7 @@ test "a column's ctl and exec act on it as its tag would, and rmdir closes it on
const empty = layout.columnSerial(p, 1);
// New on the empty column's ctl fills it, wherever the keyboard is.
try testing.expectEqual(tree.Status.ok, th.wr(p, Node.ofCol(empty, .ctl), "New\n").reply.status);
- try testing.expectEqual(@as(usize, 1), p.col_n[1]);
+ try testing.expectEqual(@as(usize, 1), p.cols[1].n);
try testing.expectEqual(E.INVAL, th.wr(p, Node.ofCol(empty, .ctl), "Exit\n").errno());
var rec: [64]u8 = undefined;
try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "err - col/{d}/ctl: unknown control message \"Exit\"", .{empty})));
@@ -662,7 +662,7 @@ test "tagexec runs a word as a click in the workspace tag; exec files read back
// A column's exec makes a pane there and reads it back.
const right = layout.columnSerial(p, 1);
try testing.expectEqual(tree.Status.ok, th.wr(p, Node.ofCol(right, .exec), "New\n").reply.status);
- const made = p.panes[p.col_panes[1][0]].?.serial;
+ const made = p.panes[p.cols[1].panes[0]].?.serial;
var want: [16]u8 = undefined;
try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), th.rd(p, Node.ofCol(right, .exec), 0, 64).bytes);
try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), th.rd(p, tagexec, 0, 64).bytes);
@@ -716,7 +716,7 @@ test "a column's ctl refuses an unknown word and an argument as the other ctls d
const extra = th.wr(p, ctl_node, "New extra\n");
try testing.expectEqual(E.INVAL, extra.errno());
try testing.expect(std.mem.startsWith(u8, extra.reply.ename, "wrong #args"));
- try testing.expectEqual(@as(usize, 1), p.col_n[0]);
+ try testing.expectEqual(@as(usize, 1), p.cols[0].n);
// A pane's bare answer and a winsize of no size say what they take.
try testing.expectEqualStrings("answer takes a choice or -", th.wr(p, Node.of(p.panes[0].?.serial, .ctl), "answer\n").reply.ename);
}