From 7d359addc420eca66bd1583d8fd8d6a104986a03 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 00:31:38 -0300 Subject: panes: a pane's PDF state is its own allocation, `pdf: ?*Pdf.State` (made by openPane with pdf_gpa, freed by deinitPane), as a terminal's is, where every Pane held the State inline, a text file's and a terminal's too: a Pane is 49232 bytes where it was 88936 (the State 39704), and a replica's rollback copy of a pane without a PDF is that much smaller; the dump and the wire change with it, the walk writing the slot as a pointer to a State where it wrote the State in place, so a dump written before this, or a peer of an older build, gives its PDF panes no PDF (the walk notes `Pane.pdf: its kind changed; its default taken`, and dump.ensureKind makes each a terminal); the 97 uses change form only (a `|*x|` capture or a `&` dropped, normal.zig's one among them), applyNormal untouched Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/macos.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/macos.zig') diff --git a/src/macos.zig b/src/macos.zig index 60f9e00e..af8410e0 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -880,7 +880,7 @@ fn watchInitialGeneration(st: *State, pane: u8, path: []const u8) ?file_watch.Ge const value = st.core.panes[pane] orelse return null; if (value.file) |file| if (std.mem.eql(u8, file.path, path)) return .{ .text = std.hash.Wyhash.hash(0, file.content) }; - if (comptime pardes.pdf_enabled) if (value.pdf) |*pdf| if (std.mem.eql(u8, pdf.path, path)) + if (comptime pardes.pdf_enabled) if (value.pdf) |pdf| if (std.mem.eql(u8, pdf.path, path)) return .{ .pdf = null }; return null; } @@ -998,7 +998,7 @@ fn reloadWatchedFile(st: *State, pane: u8, announce: bool) bool { }, .pdf => |old_identity| pdf: { if (comptime !pardes.pdf_enabled) break :pdf .no_change; - const state_before = if (current.pdf) |*pdf_before| pdf_before else break :pdf .no_change; + const state_before = if (current.pdf) |pdf_before| pdf_before else break :pdf .no_change; if (!std.mem.eql(u8, state_before.path, watched.path)) break :pdf .no_change; const before = file_watch.identify(st.io, watched.path) catch { retryWatchedFile(st, pane, generation); @@ -1012,7 +1012,7 @@ fn reloadWatchedFile(st: *State, pane: u8, announce: bool) bool { const after = st.core.panes[pane] orelse break :pdf .changed_uncommitted; if (after.serial != watched.serial) break :pdf .changed_uncommitted; - const pdf_state = if (after.pdf) |*pdf_after| pdf_after else break :pdf .changed_uncommitted; + const pdf_state = if (after.pdf) |pdf_after| pdf_after else break :pdf .changed_uncommitted; if (!std.mem.eql(u8, pdf_state.path, watched.path)) break :pdf .changed_uncommitted; const after_identity = file_watch.identify(st.io, watched.path) catch { retryWatchedFile(st, pane, generation); -- cgit v1.3