summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:55:35 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:02:08 -0300
commitaac802c58937053a200b0392843195b128a21172 (patch)
tree67ea31d4f5be6eb5b8ef8ea9ef301e3874b1cebd /src/look.zig
parent7fb385cb7882f79bd448250b176f2d3a81de64f6 (diff)
downloadpardes-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/look.zig')
-rw-r--r--src/look.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/look.zig b/src/look.zig
index 1f81d6ec..a230d740 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -1046,7 +1046,7 @@ fn openPaneTarget(p: *const Pardes, path: []const u8, at: Spot) ?Target {
if (tt.image) |iv| if (std.mem.eql(u8, iv.path, path)) {
return .{ .pane = .{ .id = i, .at = .{} } };
};
- if (comptime pdf_enabled) if (tt.pdf) |pv| if (std.mem.eql(u8, pv.path, path)) {
+ if (comptime pdf_enabled) if (tt.pdf) |*pv| if (std.mem.eql(u8, pv.path, path)) {
return .{ .pane = .{ .id = i, .at = at } };
};
const ff = if (tt.file) |*f| f else continue;
@@ -1149,7 +1149,7 @@ fn canonicalLookLocation(p: *Pardes, id: usize, text: []const u8) ?[]const u8 {
if (target.id >= p.panes.len) return null;
const pane = p.panes[target.id] orelse return null;
if (pane.file) |file| return locationText(p, file.path, target.at);
- if (comptime pdf_enabled) if (pane.pdf) |doc| return locationText(p, doc.path, target.at);
+ if (comptime pdf_enabled) if (pane.pdf) |*doc| return locationText(p, doc.path, target.at);
if (pane.image) |iv| return locationText(p, iv.path, target.at);
var path: [32]u8 = undefined;
return locationText(p, std.fmt.bufPrint(&path, config.pane_addr ++ "{d}", .{pane.serial}) catch return null, target.at);
@@ -1159,7 +1159,7 @@ fn canonicalLookLocation(p: *Pardes, id: usize, text: []const u8) ?[]const u8 {
pub fn pdfLinkLocation(p: *Pardes, pane: *const Pane, link: if (pdf_enabled) pdf.Link else void) ?[]const u8 {
if (comptime !pdf_enabled) return null;
- const state = pane.pdf orelse return null;
+ const state = &(pane.pdf orelse return null);
const id = p.paneIdOf(pane) orelse return null;
return switch (link.destination) {
.none => null,