summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 00:31:38 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:02:28 -0300
commit7d359addc420eca66bd1583d8fd8d6a104986a03 (patch)
tree2b8991a9a4e5b9c16a2b7683018d60c7c6985c1e /src/pardes.zig
parent96cabca7ebe287692ebdff0dba6bb2897eba9d3e (diff)
downloadpardes-7d359addc420eca66bd1583d8fd8d6a104986a03.tar.gz
pardes-7d359addc420eca66bd1583d8fd8d6a104986a03.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 14c6bd98..bc0266c5 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -4600,7 +4600,7 @@ pub const Pardes = struct {
if (pane.image) |*iv| {
iv.deinit(p.image_gpa);
}
- if (comptime pdf_enabled) if (pane.pdf) |*pv| panes.Pdf.deinitPane(p, pane, pv);
+ if (comptime pdf_enabled) if (pane.pdf) |pv| panes.Pdf.deinitPane(p, pane, pv);
if (pane.file) |*file| panes.File.deinit(p, pane, file);
if (pane.ovl) |o| p.gpa.free(o.text);
views.tornDown(p, pane);
@@ -5743,7 +5743,7 @@ pub const Pardes = struct {
layout.compute(p);
for (p.panes, 0..) |slot, id| {
const pane = slot orelse continue;
- if (pane.pdf) |*pv| {
+ if (pane.pdf) |pv| {
if (!std.meta.eql(before[id], panes.Pdf.paneViewport(p, pane))) {
panes.Pdf.captureLayoutAnchor(pv);
pv.layout_valid = false;
@@ -6331,7 +6331,7 @@ pub const Pardes = struct {
.none => {},
}
if (pane.file) |f| return panes.Dir.ofName(f.path);
- if (comptime pdf_enabled) if (pane.pdf) |*pv|
+ if (comptime pdf_enabled) if (pane.pdf) |pv|
return std.fs.path.dirname(pv.path) orelse "/";
if (pane.image) |iv| return std.fs.path.dirname(iv.path) orelse "/";
return pane.cwdSlice();
@@ -7413,7 +7413,7 @@ pub const Pardes = struct {
for (p.panes) |slot| if (slot) |pane| if (pane.places.busy(pane)) return next;
for (p.panes) |slot| if (slot) |pane| if (pane.image) |iv| if (iv.decoder != null) return next;
// A PDF page being rendered on a lane lands on the frame after it is done.
- if (comptime pdf_enabled) for (p.panes) |slot| if (slot) |pane| if (pane.pdf) |*st| if (panes.Pdf.rendering(st)) return next;
+ if (comptime pdf_enabled) for (p.panes) |slot| if (slot) |pane| if (pane.pdf) |st| if (panes.Pdf.rendering(st)) return next;
// A markdown text's tables still being read from the top (Tables.zig).
for (p.panes) |slot| if (slot) |pane| if (pane.file) |f| if (f.tables.busy()) return next;
if (panes.Query.busy(p)) return next;