Skip to content

Fix: tab switch restores exact scroll position within page - #9

Merged
Marvelxy merged 1 commit into
mainfrom
fix/tab-switch-restores-scroll-position
Oct 21, 2026
Merged

Marvelxy merged 1 commit into
mainfrom
fix/tab-switch-restores-scroll-position

Conversation

@Marvelxy

Copy link
Copy Markdown
Owner

Switching tabs captures the outgoing tab's exact visible location (page + point) and switching back navigates to that captured destination instead of the page top. Pending navigation is now convergent (re-issued until the view reports the target page, 2s deadline) because a single deferred go(to:) could be clobbered by PDFView's initial layout pass, resetting to page 0. Clicking the active tab / re-opening the active file no longer reloads.

Switching tabs now captures the outgoing tab's exact visible location
(page + point, from PDFView.currentDestination) and, when switching
back, navigates to that captured destination instead of only the page
top. Pending navigation became convergent: applyPendingNavigation
re-issues go(to:) one runloop turn apart until the view reports the
target page (bounded by a 2s deadline), because a single deferred go
around the document commit could be clobbered by PDFView's initial
layout pass, silently resetting the view to page 0. Clicking the
already-active tab / re-opening the already-shown file no longer
reloads the document (which would reset the position).
@Marvelxy
Marvelxy merged commit 28549e2 into main Oct 21, 2026
1 check passed
@Marvelxy
Marvelxy deleted the fix/tab-switch-restores-scroll-position branch October 21, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant