Merge pull request #15698 from Snuffleupagus/DIACRITICS_EXCEPTION_STR-lazy
Initialize the find-related `DIACRITICS_EXCEPTION_STR` constant lazily
This commit is contained in:
commit
e089d07994
@ -76,9 +76,7 @@ const DIACRITICS_EXCEPTION = new Set([
|
|||||||
// https://www.compart.com/fr/unicode/combining/132
|
// https://www.compart.com/fr/unicode/combining/132
|
||||||
0x0f74,
|
0x0f74,
|
||||||
]);
|
]);
|
||||||
const DIACRITICS_EXCEPTION_STR = [...DIACRITICS_EXCEPTION.values()]
|
let DIACRITICS_EXCEPTION_STR; // Lazily initialized, see below.
|
||||||
.map(x => String.fromCharCode(x))
|
|
||||||
.join("");
|
|
||||||
|
|
||||||
const DIACRITICS_REG_EXP = /\p{M}+/gu;
|
const DIACRITICS_REG_EXP = /\p{M}+/gu;
|
||||||
const SPECIAL_CHARS_REG_EXP =
|
const SPECIAL_CHARS_REG_EXP =
|
||||||
@ -675,6 +673,10 @@ class PDFFindController {
|
|||||||
if (matchDiacritics) {
|
if (matchDiacritics) {
|
||||||
// aX must not match aXY.
|
// aX must not match aXY.
|
||||||
if (hasDiacritics) {
|
if (hasDiacritics) {
|
||||||
|
DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(
|
||||||
|
...DIACRITICS_EXCEPTION
|
||||||
|
);
|
||||||
|
|
||||||
isUnicode = true;
|
isUnicode = true;
|
||||||
query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\p{M}]|$)`;
|
query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\p{M}]|$)`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user