Merge pull request #10223 from Snuffleupagus/find-reset-on-query-change

When the search query changes, regardless of the search command, always re-calculate matches (bug 1030622)
This commit is contained in:
Tim van der Meij 2018-11-10 20:10:22 +01:00 committed by GitHub
commit 5706961452
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
@ -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;