diff options
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/cols.zig | 31 | ||||
| -rw-r--r-- | src/ninep/ctl.zig | 16 | ||||
| -rw-r--r-- | src/ninep/tree.zig | 1 |
3 files changed, 21 insertions, 27 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index 0ee25345..833b25c5 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -564,23 +564,20 @@ test "a column's tag and the workspace's read, replace and append as a pane tag } test "a focus write makes its pane's column the active one: layout says so and pane/new goes there" { - for ([_][]const u8{ "Placement acme", "Placement pardes" }) |placement| { - const p = try th.withFile(testing.allocator, "x\n"); - defer p.deinit(); - try testing.expect(p.executeBuiltinLine(p.active, placement)); - const left = p.panes[0].?.serial; - p.newColumn(p.active); - p.newScratchFor(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; - _ = th.wr(p, @backingInt(tree.TopFile.focus), try std.fmt.bufPrint(&digits, "{d}\n", .{left})); - var want: [32]u8 = undefined; - const text = th.rd(p, @backingInt(tree.TopFile.layout), 0, 4096).bytes; - try testing.expect(std.mem.endsWith(u8, text, try std.fmt.bufPrint(&want, "active {d}\n", .{layout.columnSerial(p, 0)}))); - const made = th.call(p, .{ .tag = 1, .op = .open, .node = @backingInt(tree.TopFile.new) }).reply.handle; - try testing.expectEqual(@as(usize, 0), layout.findPane(p, p.paneBySerial(made).?).?.col); - } + const p = try th.withFile(testing.allocator, "x\n"); + defer p.deinit(); + const left = p.panes[0].?.serial; + p.newColumn(p.active); + p.newScratchFor(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; + _ = th.wr(p, @backingInt(tree.TopFile.focus), try std.fmt.bufPrint(&digits, "{d}\n", .{left})); + var want: [32]u8 = undefined; + const text = th.rd(p, @backingInt(tree.TopFile.layout), 0, 4096).bytes; + try testing.expect(std.mem.endsWith(u8, text, try std.fmt.bufPrint(&want, "active {d}\n", .{layout.columnSerial(p, 0)}))); + const made = th.call(p, .{ .tag = 1, .op = .open, .node = @backingInt(tree.TopFile.new) }).reply.handle; + try testing.expectEqual(@as(usize, 0), layout.findPane(p, p.paneBySerial(made).?).?.col); } test "a refused write after a truncation leaves every kind of tag as it was, and Dump still works" { diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index cb4cfa97..2a2131e3 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -91,7 +91,7 @@ pub fn run(p: *Pardes, id: usize, exec: bool, text: []const u8, in_tag: bool) vo for (after.list[0..after.len]) |serial| if (std.mem.indexOfScalar(u32, before.list[0..before.len], serial) == null) { // A query pane's +Preview is its query pane's: that answers. if (p.paneBySerial(serial)) |made| if (p.panes[made].?.file) |f| if (f.output) |o| if (o.from == .preview) continue; - // A look that made a +Search pane (LookWord list, a terminal) + // A look that made a +Search pane (a terminal's word) // answers it: that is where the places it found are. noteResult(p, serial); created = true; @@ -732,9 +732,9 @@ pub fn fillPager(p: *Pardes, serial: u32, held: *std.ArrayList(u8)) error{OutOfM f.pager_spans = page.spans; f.saved_revision = f.revision; // A diff paged (`git show`, difftui's patches): its hunks stacked in a - // +Diff (DiffLook hunks) in the +Pager's place, the +Pager closed. The - // keyboard stays where it was, as a page's. - if (f.pager_diff and p.settings.diff_look == .hunks) { + // +Diff in the +Pager's place, the +Pager closed. The keyboard stays + // where it was, as a page's. + if (f.pager_diff) { const keyboard = p.active; if (panes.Output.openDiff(p, id, f.path, f.content)) |hid| { // ponytail: the text is gone with it; Diff on the +Diff says no such file. @@ -954,7 +954,7 @@ pub fn writeFocus(p: *Pardes, req: Req) Reply { const id = p.paneBySerial(serial) orelse return tree.failText(req.tag, E.NOENT, e_no_pane); // The keyboard goes to the pane itself, off any header that had it, and // its column becomes the active one, as the user's click there would - // make it: pane/new and a look place there next, whatever Placement. + // make it: pane/new and a look place there next. tagline.exitHeader(p); p.active = id; if (pardes.layout.findPane(p, id)) |at| p.setActiveColumn(at.col); @@ -1429,7 +1429,7 @@ test "commands lists every builtin with its argument and the ctl that takes it" var here: usize = 0; for (std.enums.values(Builtin)) |b| here += @intFromBool(builtins.registry.here(p, b)); try testing.expectEqual(here, lines); - for ([_][]const u8{ "\nDel arg pane -- ", "\nNewcol root -- ", "\nSave arg pane", "\nVerbose arg root on,off", "\nPlacement arg root acme,pardes", "\nUndo pane -- ", "\nEdit arg both -- acme's Edit" }) |row| + for ([_][]const u8{ "\nDel arg pane -- ", "\nNewcol root -- ", "\nSave arg pane", "\nVerbose arg root on,off", "\nUndo pane -- ", "\nEdit arg both -- acme's Edit" }) |row| try testing.expect(std.mem.indexOf(u8, listed.bytes, row) != null); } @@ -2052,10 +2052,9 @@ test "a terminal told the directory it already goes by logs no rename" { try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "rename {d} /usr", .{p.panes[term].?.serial}))); } -test "a terminal with text typed at its prompt is never typed into: a look at its directory opens another" { +test "a terminal with text typed at its prompt is never typed into: a look at its directory or an exec at it opens a pane of its own" { const p = try th.withTerm(testing.allocator); defer p.deinit(); - p.settings.dir_look = .terminal; // `ls` in a terminal, not a directory pane const term = p.paneBySerial(serialOf(p)).?; p.setCwd(term, "/tmp"); p.update(.{ .output = .{ .pane = @intCast(term), .bytes = "\x1b]133;A;aid=pardes\x07$ \x1b]133;B;aid=pardes\x07TYPED" } }); @@ -2598,7 +2597,6 @@ test "every word's /commands description is its own doc comment's first sentence "\nNewcol root -- An empty column right of the keyboard's, its tag taking the keyboard.\n", "\nSave arg pane -- Write the pane's text to its file, or to the file its argument names.\n", "\nVerbose arg root on,off -- A builtin says its own name on the message row as it runs, on or off.\n", - "\nPlacement arg root acme,pardes -- Where a new pane goes: acme, as makenewwindow does, or pardes, the older rules.\n", "\nKill arg root -- acme's Kill: stop the commands pardes started", }) |row| try testing.expect(std.mem.indexOf(u8, listed, row) != null); try testing.expect(std.mem.indexOf(u8, listed, ".c:") == null); diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 6bd4e007..24de3e76 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -1827,7 +1827,6 @@ test "random placements, refused or not, leave no pane under its tag and two row _ = try p.setTestFile("x\n"); while (p.nextEffect()) |_| {} for (0..r.uintLessThan(usize, 3)) |_| _ = th.wr(p, Node.of(serialOf(p), .exec), "Newcol\n"); - if (r.boolean()) p.settings.placement = .pardes; for (0..40) |step| { var serials: [pardes.MAX_PANES]u32 = undefined; var n: usize = 0; |
