diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:55:35 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:02:08 -0300 |
| commit | aac802c58937053a200b0392843195b128a21172 (patch) | |
| tree | 67ea31d4f5be6eb5b8ef8ea9ef301e3874b1cebd /src/panes.zig | |
| parent | 7fb385cb7882f79bd448250b176f2d3a81de64f6 (diff) | |
| download | pardes-aac802c58937053a200b0392843195b128a21172.tar.gz pardes-aac802c58937053a200b0392843195b128a21172.zip | |
pdf: every by-value copy of a pane's PDF state (about 39 KB, its 256 raster slots) taken to read a field or two is a pointer capture, in panes, edit, mouse, tagline, look, exec, the core, 9P ctl, fs, draw, macos and the sections bench; the hot one is pdf_view.moving, which Pardes.continuous asks on every pass of the shell loop and which copied every PDF pane's state each time
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/panes.zig')
| -rw-r--r-- | src/panes.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/panes.zig b/src/panes.zig index f4b25929..f7a3cf8a 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -509,12 +509,12 @@ pub const Pane = struct { } pub fn pdfPath(pane: *const Pane) ?[]const u8 { - if (comptime Pdf.enabled) if (pane.pdf) |pv| return pv.path; + if (comptime Pdf.enabled) if (pane.pdf) |*pv| return pv.path; return null; } pub fn pdfPage(pane: *const Pane) ?usize { - if (comptime Pdf.enabled) if (pane.pdf) |pv| return pv.page; + if (comptime Pdf.enabled) if (pane.pdf) |*pv| return pv.page; return null; } @@ -538,7 +538,7 @@ pub const Pane = struct { /// current scroll offset: file top line, or the scrollback offset pub fn scroll(pane: *Pane) i32 { if (pane.file) |f| return @intCast(f.scroll); - if (comptime Pdf.enabled) if (pane.pdf) |pv| return @intCast(pv.text_scroll); + if (comptime Pdf.enabled) if (pane.pdf) |*pv| return @intCast(pv.text_scroll); return pane.surfRow(terminal.gridOffset(pane) + pane.pan); } @@ -637,7 +637,7 @@ pub const Pane = struct { to = @min(to, if (off == 0 and pane.textFits()) @max(pane.body.cur_row, lines - 1 - @intFromBool(std.mem.endsWith(u8, f.content, "\n"))) else lines - 1); } if (comptime Pdf.enabled) { - if (pane.pdf) |pv| + if (pane.pdf) |*pv| to = @min(to, @as(i32, @intCast(modal.lineCount(pv.text) -| 1))); } pane.scrollBy(@max(0, to - last)); @@ -684,7 +684,7 @@ pub const Pane = struct { pub fn hasPdfSelection(pane: *const Pane) bool { return if (comptime Pdf.enabled) - if (pane.pdf) |pv| pv.selection != null and pv.selection_text.len > 0 else false + if (pane.pdf) |*pv| pv.selection != null and pv.selection_text.len > 0 else false else false; } |
