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/macos.zig | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/macos.zig') diff --git a/src/macos.zig b/src/macos.zig index bc906dea..e69a2fbe 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -1756,16 +1756,15 @@ fn encodeChanged(diff: pardes.PanelCellDiff) u8 { fn collectImages(st: *State, surface: *const pardes.Surface) void { if (comptime !pardes.pdf_enabled) return; - if (surface.nimages == 0) return; - if (st.images.len < surface.nimages) { + if (surface.images.items.len == 0) return; + if (st.images.len < surface.images.items.len) { const resized = if (st.images.len == 0) - st.gpa.alloc(Image, surface.nimages) + st.gpa.alloc(Image, surface.images.items.len) else - st.gpa.realloc(st.images, surface.nimages); + st.gpa.realloc(st.images, surface.images.items.len); st.images = resized catch return; } - for (surface.images[0..surface.nimages]) |maybe| { - const place = maybe orelse continue; + for (surface.images.items) |place| { if (place.iw == 0 or place.ih == 0 or place.rgba.len == 0) continue; const geometry = place.native.geometry orelse image.NativeGeometry{ .src = .{ .x = 0, .y = 0, .w = @intCast(place.iw), .h = @intCast(place.ih) }, -- cgit v1.3