summaryrefslogtreecommitdiff
path: root/test/kitty.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 00:22:27 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:00:59 -0300
commit1b12f7aadaf0e0a4570a5985900f61d0fb897f79 (patch)
tree2563f00aa47d3ef39ef1647482ba5d19bc1373a1 /test/kitty.zig
parentb283824eed0703ae9b89f2af520354046146b855 (diff)
downloadpardes-1b12f7aadaf0e0a4570a5985900f61d0fb897f79.tar.gz
pardes-1b12f7aadaf0e0a4570a5985900f61d0fb897f79.zip
surface: a frame's images are a std.ArrayList(ImagePlace), where they were a slice of optionals grown by hand (appendImagePlace's doubling realloc, nimages beside it) whose slots were never null: every reader's `orelse continue` and `.?` go (gui, tui, terminal, TerminalImages, ninep/screen, test/pdf.zig, kitty and the two PDF benches); macos.zig's loop the same, passing ast-check but not built here
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/kitty.zig')
-rw-r--r--test/kitty.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/kitty.zig b/test/kitty.zig
index f5de44e7..737e8fbf 100644
--- a/test/kitty.zig
+++ b/test/kitty.zig
@@ -125,10 +125,10 @@ const Rig = struct {
return &r.vt(id).screens.active.kitty_images;
}
- fn places(r: *Rig) ![]const ?pardes.ImagePlace {
+ fn places(r: *Rig) ![]const pardes.ImagePlace {
_ = r.frame.reset(.retain_capacity);
const s = try r.p.render(r.frame.allocator());
- return s.images[0..s.nimages];
+ return s.images.items;
}
/// The top-left cell of pane `id`'s body, in screen cells.
@@ -140,7 +140,7 @@ const Rig = struct {
/// The places drawn for the image a program called `image_id`.
fn placesOf(r: *Rig, image_id: u32) ![]const pardes.ImagePlace {
var out: std.ArrayList(pardes.ImagePlace) = .empty;
- for (try r.places()) |maybe| if (maybe) |place| if (place.native.page == image_id)
+ for (try r.places()) |place| if (place.native.page == image_id)
try out.append(r.frame.allocator(), place);
return out.items;
}
@@ -440,8 +440,8 @@ test "kitty: z-index travels with the image, and images are handed on lowest z f
var zs: [4]i32 = undefined;
var ids: [4]u32 = undefined;
for (drawn, 0..) |place, i| {
- zs[i] = place.?.z;
- ids[i] = place.?.native.page;
+ zs[i] = place.z;
+ ids[i] = place.native.page;
}
try std.testing.expectEqualSlices(i32, &.{ -7, 0, 3, 5 }, &zs);
try std.testing.expectEqualSlices(u32, &.{ 9, 10, 11, 8 }, &ids);
@@ -1293,9 +1293,9 @@ test "kitty: recorded kitten icat and chafa traffic replays: answers whole, imag
};
const o = r.origin(0);
var top: ?pardes.ImagePlace = null;
- for (drawn) |maybe| if (maybe) |place| {
+ for (drawn) |place| {
if (top == null or place.y < top.?.y or (place.y == top.?.y and place.x < top.?.x)) top = place;
- };
+ }
const first = top orelse {
std.debug.print("{s}: nothing drawn\n", .{rec.name});
return error.NothingDrawn;