Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — PDF search now treats straight and curly quotes equivalently for page results and highlights. The change is limited to local search matching and does not modify documents or stored data. You can add or adjust custom eligibility rules. Learn more. |
Walkthrough
Merge Risk:
|
|
Note Written by Merged main without rebasing at d926154. The diff against that base remains two files, 22 additions and 5 deletions. This brings main's existing file-save browser timeout fix into the branch; no PDF code changes were needed. Blacksmith Verified in the real client's PDF.js fallback with a typeset PDF: straight apostrophes and double quotes find curly text and highlight it; missing and cleared searches remove highlights. Chrome's native viewer was also exercised, then native PDF support was disabled for the fallback check. CI is blocked by an unrelated failure also present on main: |








Problem
In the PDF viewer, typing
don'tinto find never matches thedon’tin a typeset PDF. No page is listed and nothing is highlighted. Typeset documents almost always use curly apostrophes and quotes (’ ‘ “ ”), but the find box gets the straight ones you type on a desktop keyboard. pdf.js's own find folds these characters, and our find helpers say they follow "pdf.js's own find", but they only lowercase.Change
pdfLayout.tsgets a smallfoldQuoteshelper. It maps U+2018–U+201B to'and U+201C–U+201F to", the same ranges as pdf.js'sCHARACTERS_TO_NORMALIZE. BothpdfFindIncludes(which picks pages) andpdfFindMatchRuns(which highlights spans) apply it to the page text and the query, so page results and highlights still agree. Each fold swaps one UTF-16 unit for one unit, so the per-character run map that drives highlights stays aligned. This is the same fold #29759 added to in-thread find.Scope and approval
This is a very small, focused fix for an obvious bug, so there is no prior issue. The helpers already promise to behave like pdf.js find, and this brings their quote handling in line with that promise. It changes one file plus one test case. Diacritics, ligatures and other pdf.js normalizations are left out.
Overlap search: I searched the local PR index and GitHub for PDF find / apostrophe / curly quote. The closest are #25702 (PDF find across wrapped lines, which added these helpers but not quote folding), #29759 (in-thread find, different code) and #27267 (server message search, different code). None touch
pdfLayout.tsquote handling.Verification
vp test run src/components/files/pdfLayout.test.ts→AssertionError: expected [ false, false ] to deeply equal [ true, false ]for the new "matches straight quotes typed for typeset curly ones" case.vp run check:changed: passes.Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code
Takeover verification
Note
Written by
gpt-6.1-solon behalf of MariaMerged main without rebasing at d926154. The diff against that base remains two files, 22 additions and 5 deletions. This brings main's existing file-save browser timeout fix into the branch; no PDF code changes were needed.
Blacksmith
vp run check:changed github/mainpassed format, lint, knip, typecheck and 11 test files. The 18 PDF tests and the exact file-save browser test also passed. Two independent code reviews found no issues.Verified in the real client's PDF.js fallback with a typeset PDF: straight apostrophes and double quotes find curly text and highlight it; missing and cleared searches remove highlights. Chrome's native viewer was also exercised, then native PDF support was disabled for the fallback check.
CI is blocked by an unrelated failure also present on main:
check-changed.test.ts/lints an Astro component and runs knip when only it changedexpects a lint command without--no-error-on-unmatched-pattern. Main run 41561598417 and this PR run 41562197999 fail identically. Left that unrelated code untouched.