diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 0054576ff2193..80954b5a17e7d 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -2821,7 +2821,7 @@ class PartialEvaluator { continue; } - if (!compareWithLastPosition()) { + if (!category.isZeroWidthDiacritic && !compareWithLastPosition()) { // The glyph is not in page so just skip it. continue; } diff --git a/test/unit/pdf_find_controller_spec.js b/test/unit/pdf_find_controller_spec.js index 7326f17b74208..22c83defb54bf 100644 --- a/test/unit/pdf_find_controller_spec.js +++ b/test/unit/pdf_find_controller_spec.js @@ -780,4 +780,42 @@ describe("pdf_find_controller", function () { }, }); }); + + it("performs a search in a text containing combining diacritics", async function () { + if (isNodeJS) { + pending("Linked test-cases are not supported in Node.js."); + } + + const { eventBus, pdfFindController } = await initPdfFindController( + "issue12909.pdf" + ); + + await testSearch({ + eventBus, + pdfFindController, + state: { + query: "הספר", + matchDiacritics: true, + }, + matchesPerPage: [0, 0, 0, 0, 0, 0, 0, 0, 1], + selectedMatch: { + pageIndex: 8, + matchIndex: 0, + }, + }); + + await testSearch({ + eventBus, + pdfFindController, + state: { + query: "הספר", + matchDiacritics: false, + }, + matchesPerPage: [0, 1, 0, 0, 0, 0, 0, 0, 1], + selectedMatch: { + pageIndex: 8, + matchIndex: 0, + }, + }); + }); });