diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 08:23:46 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | 0bb3f6d4f71a3a10eba846ae3ab5064630b12201 (patch) | |
| tree | 0edd1670bca26434325e29fb8768ca793649e3b5 /src/ninep | |
| parent | 8157972cff633ee0135c81fd3f1195d9a73eb92f (diff) | |
| download | pardes-0bb3f6d4f71a3a10eba846ae3ab5064630b12201.tar.gz pardes-0bb3f6d4f71a3a10eba846ae3ab5064630b12201.zip | |
A new terminal is named by its directory from the start, so its shell arriving there is no rename
Tty's terminal was `new N /` until its shell reported its directory, then
`rename N <dir>`: a rename for no change of place. The pane owns the
directory it is started in from the first; only a move elsewhere renames.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/ctl.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 0ec5dc2a..30091ae1 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1856,6 +1856,22 @@ test "Unmount of a name not mounted says no such mount, which a mount reads as E try testing.expectStringStartsWith(refused.reply.ename, "Unmount: no such mount nothere"); } +test "a terminal told the directory it already goes by logs no rename" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + _ = wr(p, Node.of(serialOf(p), .name), "/tmp/f.txt\n"); + try testing.expectEqual(Status.ok, wr(p, Node.of(serialOf(p), .ctl), "Tty\n").reply.status); + p.update(.tick); // announced + const term = p.active; + // The host says where its shell started: where it was already named. + p.setCwd(term, "/tmp"); + var rec: [32]u8 = undefined; + try testing.expect(!th.logHas(p, try std.fmt.bufPrint(&rec, "rename {d} ", .{p.panes[term].?.serial}))); + // Somewhere else is a rename. + p.setCwd(term, "/usr"); + try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "rename {d} /usr", .{p.panes[term].?.serial}))); +} + test "size is monotonic: growing is never refused, and a size once taken is taken again" { const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 60 }); defer p.deinit(); |
