Skip to content

Commit

Permalink
Merge pull request #16033 from calixteman/bug1640217
Browse files Browse the repository at this point in the history
Ignore position of combining diacritics when getting text (bug 1640217)
  • Loading branch information
calixteman authored Feb 9, 2023
2 parents 533a461 + 4e9f26a commit 972744a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2821,7 +2821,7 @@ class PartialEvaluator {
continue;
}

if (!compareWithLastPosition()) {
if (!category.isZeroWidthDiacritic && !compareWithLastPosition()) {
// The glyph is not in page so just skip it.
continue;
}
Expand Down
38 changes: 38 additions & 0 deletions test/unit/pdf_find_controller_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});
});
});

0 comments on commit 972744a

Please sign in to comment.