summaryrefslogtreecommitdiff
path: root/src/TerminalImages.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/TerminalImages.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/TerminalImages.zig')
-rw-r--r--src/TerminalImages.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/TerminalImages.zig b/src/TerminalImages.zig
index f26b5852..ab8ee099 100644
--- a/src/TerminalImages.zig
+++ b/src/TerminalImages.zig
@@ -164,10 +164,10 @@ pub fn draw(
const ctx: Ctx = .{ .ti = ti, .p = p, .s = s, .pane = pane_id, .serial = serial, .tx = tx, .body_y = body_y, .cols = cols, .rows_of = rows_of, .cw = cw, .ch = ch, .pixels = pixels };
// Handed on lowest z first (the storage's order is a hash map's), the
// order a shell draws them in; equal z keeps the order they came in.
- const first = s.nimages;
- defer std.sort.insertion(?pardes.ImagePlace, s.images[first..s.nimages], {}, struct {
- fn lessThan(_: void, a: ?pardes.ImagePlace, b: ?pardes.ImagePlace) bool {
- return (if (a) |x| x.z else 0) < (if (b) |y| y.z else 0);
+ const first = s.images.items.len;
+ defer std.sort.insertion(pardes.ImagePlace, s.images.items[first..], {}, struct {
+ fn lessThan(_: void, a: pardes.ImagePlace, b: pardes.ImagePlace) bool {
+ return a.z < b.z;
}
}.lessThan);