summaryrefslogtreecommitdiff
path: root/src/terminal.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 /src/terminal.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 'src/terminal.zig')
-rw-r--r--src/terminal.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/terminal.zig b/src/terminal.zig
index 2bd41030..04e4f233 100644
--- a/src/terminal.zig
+++ b/src/terminal.zig
@@ -3316,8 +3316,8 @@ inline fn kittyTransmit(comptime extra: []const u8) []const u8 {
};
}
-fn imagePlaces(s: *const Surface) []const ?pardes.ImagePlace {
- return s.images[0..s.nimages];
+fn imagePlaces(s: *const Surface) []const pardes.ImagePlace {
+ return s.images.items;
}
test "a terminal's kitty graphics image is drawn where its program placed it, and a delete takes it away" {
@@ -3336,7 +3336,7 @@ test "a terminal's kitty graphics image is drawn where its program placed it, an
var s = try p.render(frame.allocator());
const places = imagePlaces(s);
try std.testing.expectEqual(@as(usize, 1), places.len);
- const place = places[0].?;
+ const place = places[0];
const r = p.rects[0];
try std.testing.expect(place.native.exact);
try std.testing.expectEqual(@as(u32, 7), place.native.page);
@@ -3356,7 +3356,7 @@ test "a terminal's kitty graphics image is drawn where its program placed it, an
p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[24;1H\n\n" } });
_ = frame.reset(.retain_capacity);
s = try p.render(frame.allocator());
- try std.testing.expectEqual(p.bodyTop(pane, r), imagePlaces(s)[0].?.y);
+ try std.testing.expectEqual(p.bodyTop(pane, r), imagePlaces(s)[0].y);
p.update(.{ .output = .{ .pane = 0, .bytes = "\n" } });
_ = frame.reset(.retain_capacity);
s = try p.render(frame.allocator());
@@ -3472,9 +3472,9 @@ test "a virtual kitty placement shows through its placeholder cells, which draw
const r = p.rects[0];
const tx = r.x + config.GUTTER;
const y = p.bodyTop(pane, r) + 1;
- try std.testing.expectEqual(tx + 2, places[0].?.x);
- try std.testing.expectEqual(y, places[0].?.y);
- try std.testing.expectEqual(@as(u16, 2), places[0].?.w);
+ try std.testing.expectEqual(tx + 2, places[0].x);
+ try std.testing.expectEqual(y, places[0].y);
+ try std.testing.expectEqual(@as(u16, 2), places[0].w);
try std.testing.expectEqualStrings(" ", s.at(tx + 2, y).grapheme());
try std.testing.expectEqualStrings(" ", s.at(tx + 3, y).grapheme());
try std.testing.expectEqualStrings("X", s.at(tx + 4, y).grapheme());