Skip to content

Keep text selection alive during progressive page loading - #695

Merged
espresso3389 merged 1 commit into
espresso3389:masterfrom
Guesub:fix/keep-selection-during-progressive-load
Aug 19, 2026
Merged

Keep text selection alive during progressive page loading#695
espresso3389 merged 1 commit into
espresso3389:masterfrom
Guesub:fix/keep-selection-during-progressive-load

Conversation

@Guesub

@Guesub Guesub commented Aug 19, 2026

Copy link
Copy Markdown

Problem

_onDocumentEvent unconditionally calls _clearTextSelections on every PdfDocumentPageStatusChangedEvent. 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.

_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.
@espresso3389
espresso3389 merged commit 9567485 into espresso3389:master Aug 19, 2026
11 of 12 checks passed
@espresso3389

Copy link
Copy Markdown
Owner

This fix has been released in pdfrx 2.4.8.

Written by Codex

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.

2 participants