summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 18:04:25 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commitf65cb652243bf0a63eecdd4d6c5cd8ccbc3fd2ea (patch)
tree28f31651e214eaf4177209122e263fefaf186328 /src/ninep/ctl.zig
parentb608fc54c40ff3dff6057569bd65d3f729c6d4f9 (diff)
downloadpardes-f65cb652243bf0a63eecdd4d6c5cd8ccbc3fd2ea.tar.gz
pardes-f65cb652243bf0a63eecdd4d6c5cd8ccbc3fd2ea.zip
Under pardes's placement a pane whose neighbour is in no column goes at a column's foot, not nowhere
After Delcol took the last column's panes, pane/new under Placement made a scratch that no column held, since a scratch was placed only under the asking pane, which was gone; a look from it then unwrapped the missing parent in belowParent and panicked (the 9P monkey's crash-e1873f34). Both now fall back to the foot of the active column, else the last. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index b9268208..59a80f36 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1752,6 +1752,26 @@ test "a look after Newcol fills the empty column the keyboard is on" {
try testing.expectEqual(p.active, p.col_panes[p.ncol - 1][0]);
}
+test "a look under pardes's placement, from a pane pane/new made after Delcol, opens its file" {
+ const gpa = testing.allocator;
+ const p = try withFile(gpa, "x\n");
+ defer p.deinit();
+ var tmp = testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(testing.io, .{ .sub_path = "f.txt", .data = "file\n" });
+ var dir: [4096]u8 = undefined;
+ const at = dir[0..try tmp.dir.realPath(testing.io, &dir)];
+ var line: [4200]u8 = undefined;
+ const first = serialOf(p);
+ try testing.expectEqual(tree.Status.ok, wr(p, Node.of(first, .exec), "Placement\n").reply.status);
+ try testing.expectEqual(tree.Status.ok, wr(p, Node.of(first, .exec), "Delcol\n").reply.status);
+ const made = try th.newPane(p);
+ try testing.expectEqual(tree.Status.ok, wr(p, Node.of(made, .look), try std.fmt.bufPrint(&line, "{s}/f.txt:#4\n", .{at})).reply.status);
+ // The pane pane/new made is placed, and so is the one its look opened.
+ for (p.panes, 0..) |slot, i| if (slot != null) try testing.expect(layout.findPane(p, i) != null);
+ try testing.expect(p.panes[p.active].?.serial != made);
+}
+
test "a Restore of a file that is no dump fails the write before any warning, and a failed Dump fails its write" {
if (comptime !pardes.hosted) return error.SkipZigTest;
const p = try withFile(testing.allocator, "x\n");