summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 20:09:32 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commitf8fe738416fe3a40a7136f2cb5528e8fd57f40df (patch)
tree4f5f3ff990d79523a191c0754a154f3f5ffdee43 /src/look.zig
parent506ca99f13aec67d593e4a30bbe416dea176d0ba (diff)
downloadpardes-f8fe738416fe3a40a7136f2cb5528e8fd57f40df.tar.gz
pardes-f8fe738416fe3a40a7136f2cb5528e8fd57f40df.zip
Recent and /recent keep PDFs and images as they keep files, and an open file's row is where its dot is now
Only text files were recorded, so a PDF read yesterday was not there to find again, and an open file's row showed the place it last closed at, stale by however far it had moved since. A PDF is kept at its page and reopened there from its row; an image by its path; an open one's row reads its pane's place at the time of the listing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/look.zig b/src/look.zig
index 2e8a4b39..36b91545 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -1481,6 +1481,11 @@ pub fn reopenAt(p: *Pardes, from: usize, path: []const u8, at: Spot) void {
lookAt(p, from, path);
const id = p.active;
const pane = p.panes[id] orelse return;
+ // A PDF's place is its page, the last if it has fewer now.
+ if (comptime pdf_enabled) if (pane.pdf) |*pv| if (std.mem.eql(u8, pv.path, path)) {
+ if (at.line > 0 and pv.focusLocation(p.pdf_gpa, @min(at.line, pv.page_count), 0)) panes.Pdf.resetPageChrome(pane);
+ return;
+ };
const f = if (pane.file) |*file| file else return;
if (!std.mem.eql(u8, f.path, path)) return;
// The empty "line" after a final newline is no line to land on.