summaryrefslogtreecommitdiff
path: root/src/tui
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/tui
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/tui')
-rw-r--r--src/tui/tui.zig10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/tui/tui.zig b/src/tui/tui.zig
index e7fde434..0230e7a9 100644
--- a/src/tui/tui.zig
+++ b/src/tui/tui.zig
@@ -1191,8 +1191,8 @@ test "host watch closes initial race and reloads rename-over PDF while idle" {
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
const surface = try core.render(frame.allocator());
- try std.testing.expect(surface.nimages > 0);
- try std.testing.expectEqual(@as(u32, 0), surface.images[0].?.native.page);
+ try std.testing.expect(surface.images.items.len > 0);
+ try std.testing.expectEqual(@as(u32, 0), surface.images.items[0].native.page);
}
fn kittyImageRepresentable(place: pardes.ImagePlace) bool {
@@ -1201,8 +1201,7 @@ fn kittyImageRepresentable(place: pardes.ImagePlace) bool {
}
fn surfaceHasKittyKey(surface: *const pardes.Surface, key: pardes.ImageCacheKey) bool {
- for (surface.images[0..surface.nimages]) |maybe| {
- const place = maybe orelse continue;
+ for (surface.images.items) |place| {
if (comptime pardes.pdf_enabled) if (!kittyImageRepresentable(place)) continue;
if (place.cacheKey().eql(key)) return true;
}
@@ -2838,8 +2837,7 @@ const Shell = struct {
paintCells(win, trailed.cells, trailed.cols, trailed.rows);
if (s.remote) |c| if (c.link.notice_len > 0) noticeLine(win, c.link.notice(), trailed.cols, trailed.rows);
tz_cells.end();
- for (surface.images[0..surface.nimages]) |maybe| {
- const place = maybe orelse continue;
+ for (surface.images.items) |place| {
if (panel_compositor.hidesAttachment(surface.panelTracks(), place.serial)) continue;
if (comptime pardes.pdf_enabled) {
if (!kittyImageRepresentable(place)) continue;