Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For repeated 'findagain' operations, attempt to reset the search position if the user has e.g. scrolled in the document (issue 4141) #10217

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

Currently we'll only attempt to start from the current page when a new search is done, however for 'findagain' operations we'll always continue from the last match position.
This could easily lead to confusing behaviour if the user has scrolled to a completely different part of the document. In an attempt to improve this somewhat, for repeated 'findagain' operations, we'll instead reset the position to the current page when it's absolutely certain that the user has scrolled.

Note that this required adding a new BaseViewer method, and exposing that through PDFLinkService, in order to check if a given page is visible.
In an attempt to avoid issues, in custom implementations of PDFFindController, the code checks for the existence of the PDFLinkService.isPageVisible method before using it.

Fixes #4141.

…by (slightly) refactoring the code responsible for calling `PDFFindController._nextMatch`

Unfortunately the `PDFFindController.executeCommand` method has now become a bit more complicated than one would like, but hopefully this small change will improve the structure somewhat (especially for subsequent patches).
…need to be re-calculated when a new search operation occurs
…tion if the user has e.g. scrolled in the document (issue 4141)

Currently we'll only attempt to start from the current page when a new search is done, however for 'findagain' operations we'll always continue from the last match position.
This could easily lead to confusing behaviour if the user has scrolled to a completely different part of the document. In an attempt to improve this somewhat, for repeated 'findagain' operations, we'll instead reset the position to the current page when it's *absolutely* certain that the user has scrolled.

Note that this required adding a new `BaseViewer` method, and exposing that through `PDFLinkService`, in order to check if a given page is visible.
In an attempt to avoid issues, in custom implementations of `PDFFindController`, the code checks for the existence of the `PDFLinkService.isPageVisible` method *before* using it.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Nov 3, 2018

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/15d6ee07abea5f4/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 3, 2018

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/15d6ee07abea5f4/output.txt

Total script time: 3.05 mins

Published

@timvandermeij timvandermeij merged commit 45758dd into mozilla:master Nov 3, 2018
@timvandermeij
Copy link
Contributor

Seems to work just fine. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants