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

#7925: added cursor position management during a search #19477

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sbelondr
Copy link

This feature allows to put the cursor at the search location with caret mode (see issue #7925 )

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch, but unfortunately this won't work as-is; see the inline comments.

As implemented, it seems that the caret isn't moved until the findbar is closed however there's no guarantee (especially in Firefox) that that ever happens.

Also, ideally this patch should include integration-tests.

Finally, please take a look at the commit history of the project to see how we usually write/format commit messages. (And please make sure to fix any spelling errors in the commit message.)

@@ -103,7 +103,7 @@ const defaultOptions = {
},
supportsCaretBrowsingMode: {
/** @type {boolean} */
value: false,
value: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be reverted.

Copy link
Collaborator

@Snuffleupagus Snuffleupagus Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this won't work in the built-in Firefox PDF Viewer since it doesn't use the web/pdf_find_bar.js file.
Probably the code would need to live in the https://github.com/mozilla/pdf.js/blob/master/web/caret_browsing.js file instead, and it's probably possible to re-use existing methods.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked in Firefox with a normal web page and whatever the caret browsing mode is, when dismissing the find bar the found text is selected.
In Chrome (with pdfium) the caret isn't moved to the last found string but in Acrobat the caret is positioned at the end of the string.
So I guess having the same behavior as in Acrobat isn't that bad, whatever the caret browsing mode is.

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

Successfully merging this pull request may close these issues.

4 participants