From 1b12f7aadaf0e0a4570a5985900f61d0fb897f79 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 00:22:27 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/tui/tui.zig | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/tui') 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; -- cgit v1.3