summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-22 09:50:43 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:24 -0300
commita8b457a306a4442975210bcac3f04b56513c61c3 (patch)
tree6e2026ecb15da2fb919a0202f5d8b38e3b36a595 /src/ninep/pane.zig
parenta8a1499bdffffc5b6919e24ec957e92fabaf003b (diff)
parent7e9d2c4169245072265b483ffaa6aa05f23f08d3 (diff)
downloadpardes-a8b457a306a4442975210bcac3f04b56513c61c3.tar.gz
pardes-a8b457a306a4442975210bcac3f04b56513c61c3.zip
Merge: Def/Refs, the diff viewer, Helix n/N, Callstack, Zig 0.17, Window mode and the terminal cwd fix onto 0.24
The docs keep both sides: 0.24's Ctrl-i fallbacks and typed ls with this line's Window mode, raw Esc and Helix n/N wording. The CHANGELOG's unreleased entries go above 0.24, Def/Refs and the context rows among them. cheatsheet-a4.pdf rendered again; .scratch/ ignored. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index 3b70d62f..dc104e4b 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -1104,7 +1104,7 @@ test "index lists serial kind dirty flag and name, and stats 0, a view generated
const p = try withFile(gpa, "hello\nthere\n");
defer p.deinit();
const pane = p.panes[0].?;
- const index = @intFromEnum(tree.TopFile.index);
+ const index = @backingInt(tree.TopFile.index);
const a = rd(p, index, 0, 4096);
try testing.expectEqual(Status.ok, a.reply.status);
@@ -1138,7 +1138,7 @@ test "a terminal is listed as term with its directory as name" {
var want: [64]u8 = undefined;
try testing.expect(std.mem.indexOf(
u8,
- rd(p, @intFromEnum(tree.TopFile.index), 0, 4096).bytes,
+ rd(p, @backingInt(tree.TopFile.index), 0, 4096).bytes,
try std.fmt.bufPrint(&want, "{d} term 0 /work/dir {d}\n", .{ pane.serial, columnOf(p, 0) }),
) != null);
try testing.expectEqualStrings("/work/dir\n", rd(p, Node.of(pane.serial, .name), 0, 4096).bytes);
@@ -1427,7 +1427,7 @@ test "a tag write past the limit is refused whole, naming the limit" {
const tag = Node.of(serialOf(p), .tag);
const before = try testing.allocator.dupe(u8, rd(p, tag, 0, 1 << 16).bytes);
defer testing.allocator.free(before);
- const big = "w" ** (limits.max_tag_tail + 10);
+ const big = &@as([limits.max_tag_tail + 10]u8, @splat('w'));
const r = wr(p, tag, big);
try testing.expectEqual(E.NOSPC, r.errno());
// `no space` is what 9ns maps to ENOSPC, so a shell through a mount
@@ -1549,20 +1549,21 @@ test "a name with a component over 255 bytes is refused, and a long path's faile
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
const serial = serialOf(p);
- const refused = wr(p, Node.of(serial, .name), "/tmp/" ++ "c" ** 256 ++ "/f.txt\n");
+ const refused = wr(p, Node.of(serial, .name), "/tmp/" ++ &@as([256]u8, @splat('c')) ++ "/f.txt\n");
try testing.expectEqual(E.INVAL, refused.errno());
try testing.expectEqualStrings("invalid file name: a component over 255 bytes", refused.reply.ename);
- try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/" ++ "c" ** 255 ++ "\n").reply.status);
+ try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/" ++ &@as([255]u8, @splat('c')) ++ "\n").reply.status);
// Held with no newline, it is refused by that write, not at the close.
const held = call(p, .{ .tag = 1, .op = .open, .node = Node.of(serial, .name), .omode = 1 }).reply.handle;
- try testing.expectEqual(E.INVAL, call(p, .{ .tag = 2, .op = .write, .node = Node.of(serial, .name), .handle = held, .data = "/tmp/" ++ "e" ** 256 }).errno());
+ try testing.expectEqual(E.INVAL, call(p, .{ .tag = 2, .op = .write, .node = Node.of(serial, .name), .handle = held, .data = "/tmp/" ++ &@as([256]u8, @splat('e')) }).errno());
_ = call(p, .{ .tag = 3, .op = .release, .node = Node.of(serial, .name), .handle = held, .opened = true });
try testing.expectEqual(@as(usize, 0), p.fs.closed_lines.items.len);
// A Save of a 3000-byte path the host refuses: the waiting write's
// reason is at the end, the path giving up its middle.
// (Under /tmp: under / a user's Save is refused permission, not
// missing.)
- const long = "/tmp/nonexistent-pardes-root/" ++ ("d" ** 200 ++ "/") ** 15 ++ "f.txt";
+ const segment = &@as([200]u8, @splat('d')) ++ "/";
+ const long = "/tmp/nonexistent-pardes-root/" ++ std.mem.asBytes(&@as([15][201]u8, @splat(segment.*))) ++ "f.txt";
const id = p.paneBySerial(serial).?;
try nameBuffer(p, id, long, false);
p.fs.late_failure_len = 0;
@@ -1750,8 +1751,8 @@ test "name refreshes cached syntax for unchanged contents" {
try testing.expectEqual(Status.ok, wr(p, Node.of(pane.serial, .name), "renamed.zig\n").reply.status);
panes.File.refreshHighlights(p);
try testing.expect(pane.file.?.highlights.len >= 2);
- try testing.expectEqual(@intFromEnum(pardes.syntax.Syn.keyword), pane.file.?.highlights[0]);
- try testing.expectEqual(@intFromEnum(pardes.syntax.Syn.keyword), pane.file.?.highlights[1]);
+ try testing.expectEqual(@backingInt(pardes.syntax.Syn.keyword), pane.file.?.highlights[0]);
+ try testing.expectEqual(@backingInt(pardes.syntax.Syn.keyword), pane.file.?.highlights[1]);
try testing.expectEqualStrings("fn check() void {}\n", pane.file.?.content);
}