diff options
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/cols.zig | 11 | ||||
| -rw-r--r-- | src/ninep/ctl.zig | 10 | ||||
| -rw-r--r-- | src/ninep/tree.zig | 3 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index d1ffc3c6..f53bb433 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -8,6 +8,7 @@ const pardes = @import("../pardes.zig"); const Pardes = pardes.Pardes; const tree = @import("tree.zig"); const limits = @import("../memory.zig").limits; +const panes = @import("../panes.zig"); const tagline = pardes.tagline; const layout = pardes.layout; const Text = pardes.panes.Text; @@ -451,11 +452,11 @@ test "New and Term run at /tagexec and a column's exec, with no pane at all too" while (p.ncol > 0) { const first = p.panes[p.col_panes[0][0]].?.serial; _ = th.wr(p, tree.Node.of(first, .ctl), "delete\n"); - if (p.anyPane() == null) break; + if (panes.anyPane(p) == null) break; } - try testing.expect(p.anyPane() == null); + try testing.expect(panes.anyPane(p) == null); try testing.expectEqual(tree.Status.ok, th.wr(p, tagexec, line).reply.status); - try testing.expect(p.anyPane() != null); + try testing.expect(panes.anyPane(p) != null); } } @@ -564,7 +565,7 @@ test "a focus write makes its pane's column the active one: layout says so and p defer p.deinit(); const left = p.panes[0].?.serial; p.newColumn(p.active); - p.newScratchFor(p.active, .fs); // fills the new, right column + panes.newScratchFor(p, p.active, .fs); // fills the new, right column p.sync(); try testing.expectEqual(@as(usize, 1), layout.findPane(p, p.active).?.col); var digits: [16]u8 = undefined; @@ -690,7 +691,7 @@ test "a command run from a column's tag gets its pane in that column, not the la const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); p.newColumn(p.active); - p.newScratchFor(p.active, .fs); // fills the new, right column + panes.newScratchFor(p, p.active, .fs); // fills the new, right column p.sync(); const left = layout.columnSerial(p, 0); try testing.expectEqual(tree.Status.ok, th.wr(p, Node.ofCol(left, .exec), "true\n").reply.status); diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 4cb4728f..2d733af6 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -210,7 +210,7 @@ pub fn command(p: *Pardes, req: Req, serial: ?u32, exec: bool, in_tag: bool) Rep // scratch made as New makes one (and its column), dropped // unannounced when the look went elsewhere. var scratch: ?usize = null; - if (p.panes[id] == null and serial == null and p.anyPane() == null) { + if (p.panes[id] == null and serial == null and panes.anyPane(p) == null) { if (exec) { p.exec_header = true; defer p.exec_header = false; @@ -218,7 +218,7 @@ pub fn command(p: *Pardes, req: Req, serial: ?u32, exec: bool, in_tag: bool) Rep continue; } const free = p.freeSlot() orelse return Reply.fail(req.tag, E.NOSPC); - p.newScratchFor(id, .scratch); + panes.newScratchFor(p, id, .scratch); if (p.panes[free] == null) return Reply.fail(req.tag, E.NOSPC); p.active = free; id = free; @@ -779,7 +779,7 @@ pub fn writeRoot(p: *Pardes, req: Req) Reply { continue; } // An empty window (no pane at all) still takes its session words. - if (p.panes[p.active] == null and p.anyPane() != null) return Reply.fail(req.tag, E.NOENT); + if (p.panes[p.active] == null and panes.anyPane(p) != null) return Reply.fail(req.tag, E.NOENT); p.fs.session_write = true; defer p.fs.session_write = false; if (runBuiltin(p, req, p.active, line)) |refusal| return refusal; @@ -2257,7 +2257,7 @@ test "with no pane at all, the root look opens its file and the root exec runs i p.session_dir_len = @intCast(session.len); const Empty = struct { fn all(q: *Pardes) !void { - while (q.anyPane()) |k| _ = wr(q, Node.of(q.panes[k].?.serial, .ctl), "delete\n"); + while (panes.anyPane(q)) |k| _ = wr(q, Node.of(q.panes[k].?.serial, .ctl), "delete\n"); } }; try Empty.all(p); @@ -2277,7 +2277,7 @@ test "with no pane at all, the root look opens its file and the root exec runs i try Empty.all(p); try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.exec), "echo hi\n").reply.status); - const made = p.panes[p.anyPane().?].?; + const made = p.panes[panes.anyPane(p).?].?; try testing.expect(made.command != null); try testing.expectEqualStrings(session, made.cwdSlice()); } diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 3b8a8581..8c0743bd 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -24,6 +24,7 @@ pub const pty = @import("pty.zig"); pub const sources = @import("sources.zig"); pub const screen = @import("screen.zig"); const daemon = @import("../daemon.zig"); +const panes = @import("../panes.zig"); const Pardes = pardes.Pardes; const Pane = pardes.Pane; @@ -836,7 +837,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; - p.newScratchFor(p.active, .fs); + panes.newScratchFor(p, p.active, .fs); p.fs.capturing = false; p.fs.failure_len = 0; const made = p.panes[slot] orelse return Reply.fail(req.tag, E.NFILE); |
