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

When the search query changes, regardless of the search command, always re-calculate matches (bug 1030622) #10223

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions web/pdf_find_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ class PDFFindController {
}

executeCommand(cmd, state) {
if (!state) {
return;
}
const pdfDocument = this._pdfDocument;

if (this._state === null || this._shouldDirtyMatch(cmd)) {
if (this._state === null || this._shouldDirtyMatch(cmd, state)) {
this._dirtyMatch = true;
}
this._state = state;
Expand Down Expand Up @@ -198,7 +201,12 @@ class PDFFindController {
return this._normalizedQuery;
}

_shouldDirtyMatch(cmd) {
_shouldDirtyMatch(cmd, state) {
// When the search query changes, regardless of the actual search command
// used, always re-calculate matches to avoid errors (fixes bug 1030622).
if (state.query !== this._state.query) {
return true;
}
switch (cmd) {
case 'findagain':
const pageNumber = this._selected.pageIdx + 1;
Expand Down