diff --git a/web/pdf_find_controller.js b/web/pdf_find_controller.js index 2411a9705..7279a6ae5 100644 --- a/web/pdf_find_controller.js +++ b/web/pdf_find_controller.js @@ -113,7 +113,7 @@ class PDFFindController { executeCommand(cmd, state) { const pdfDocument = this._pdfDocument; - if (this._state === null || cmd !== 'findagain') { + if (this._state === null || this._shouldDirtyMatch(cmd)) { this._dirtyMatch = true; } this._state = state; @@ -198,6 +198,14 @@ class PDFFindController { return this._normalizedQuery; } + _shouldDirtyMatch(cmd) { + switch (cmd) { + case 'findagain': + return false; + } + return true; + } + /** * Helper for multi-term search that fills the `matchesWithLength` array * and handles cases where one search term includes another search term (for