Keep text selection alive during progressive page loading - #695
Merged
espresso3389 merged 1 commit intoAug 19, 2026
Merged
Conversation
_onDocumentEvent cleared the text selection on every PdfDocumentPageStatusChangedEvent. During progressive loading of a large document (tens of thousands of pages) these events arrive every ~250ms, so any selection the user makes is wiped almost immediately until the whole document finishes loading. Clear the selection only when one of the changed pages actually falls inside the selected page range.
Owner
|
This fix has been released in pdfrx 2.4.8. Written by Codex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_onDocumentEventunconditionally calls_clearTextSelectionson everyPdfDocumentPageStatusChangedEvent. During progressive loading of a large document these events arrive continuously (one per load batch, every ~250 ms), so any text selection the user makes is wiped almost immediately — on a 47,352-page document the selection context menu appears and vanishes within a fraction of a second, and text selection/copy is impossible until the whole document finishes loading.Fix
Clear the selection only when one of the changed pages actually falls inside the selected page range. Loading events for unrelated (typically far-away, not-yet-loaded) pages no longer destroy the user's selection, while a genuine change to a selected page still invalidates it as before.
Verified on an iPhone with a 1.9 GB / 47,352-page PDF: long-press selection and copy now work immediately after opening, while pages keep loading in the background.