Add a helper method, in PDFFindController
, to determine if matches need to be re-calculated when a new search operation occurs
This commit is contained in:
parent
af99d1dc08
commit
d7941b4ce7
@ -113,7 +113,7 @@ class PDFFindController {
|
|||||||
executeCommand(cmd, state) {
|
executeCommand(cmd, state) {
|
||||||
const pdfDocument = this._pdfDocument;
|
const pdfDocument = this._pdfDocument;
|
||||||
|
|
||||||
if (this._state === null || cmd !== 'findagain') {
|
if (this._state === null || this._shouldDirtyMatch(cmd)) {
|
||||||
this._dirtyMatch = true;
|
this._dirtyMatch = true;
|
||||||
}
|
}
|
||||||
this._state = state;
|
this._state = state;
|
||||||
@ -198,6 +198,14 @@ class PDFFindController {
|
|||||||
return this._normalizedQuery;
|
return this._normalizedQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_shouldDirtyMatch(cmd) {
|
||||||
|
switch (cmd) {
|
||||||
|
case 'findagain':
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper for multi-term search that fills the `matchesWithLength` array
|
* Helper for multi-term search that fills the `matchesWithLength` array
|
||||||
* and handles cases where one search term includes another search term (for
|
* and handles cases where one search term includes another search term (for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user