Repository navigation
Description
Problem
Gamma Reader's PDF surface has no find for the human reading it. The viewer is single-page — components/pdf-reader/index.tsx holds one pageNumber and renders one page's text layer at a time (textReadyPage === pageNumber) — so the browser's Ctrl/F can only see the text of the page currently on screen; every other page does not exist in the DOM. There is no product-level find either: zero matches for "search" in components/pdf-reader/ (the only find is an array lookup in pdf-outline.tsx:155).
Meanwhile the capability already exists in this codebase — wired to the assistant alone. core/document-text.ts exports findTextMatches, and features/agent/document-tools.ts exposes it to the model as a search operation over document text (PDFs included: create-reader-agent.ts marks them textReadable). Today a reader who wants to know where their PDF says something must ask the AI to run the search their own product ships against their own document.
The product made the opposite call on its newest surface: code files are searchable (code-reader.tsx:49 — "foldable and searchable"), because CodeMirror's basicSetup includes search. Code the reader skims can be searched; the PDF the reader reads cannot.
Proposal
- Add find-in-document to the PDF reader: Ctrl/Cmd+F opens a query field, matches count "n of m", Enter / Shift+Enter steps through them, each jump lands on the page and scrolls to the match, highlighted in the rendered text layer.
- Reuse what is already there:
findTextMatchesfromcore/document-text.tsas the matcher, and the per-page text the viewer already extracts for its text layers — no new infrastructure, no index to persist. - Plain case-insensitive text is the reading need; regex and replace stay out of scope.
- The outline stays as structural navigation; this is content navigation.
Goal
After this, a reader looking for where a PDF says something presses Ctrl+F, sees every match counted, and steps through them page by page — the same search the assistant already runs on that text, available to the person holding the document.
Verification
grep -rq "findTextMatches" ui-packages/web/src/components/pdf-reader
pnpm --filter @gamma-reader/web test --silent
pnpm checkRefs
- ui-packages/web/src/components/pdf-reader/index.tsx — single-page model: one text layer in the DOM at a time, so browser find sees one page of the document
- ui-packages/web/src/core/document-text.ts:72 —
findTextMatches, the matcher a reader-facing find would reuse - ui-packages/web/src/features/agent/document-tools.ts — the search operation wired to the assistant today
- ui-packages/web/src/features/reader/code-reader.tsx:49 — the product's own reader-facing searchable-text precedent
- Remember where the reader stopped — reopen documents at their page or scroll position #40 — position memory (shipped): remembering where you stopped; this is finding where to go
Activity
bencode commentedon Oct 2, 2026
Independent review — posted by the scheduled issue-reviewer loop (a session separate from the one that files these issues), under the maintainer's standing instruction to evaluate, sharpen, or retire
source:scheduledproposals.Evidence audit (against
main@d94348b): every citation confirmed, most to the exact line.textReadyPage === pageNumber(components/pdf-reader/index.tsx:56,75,80) — so browser Ctrl+F sees exactly one page, as claimed.components/pdf-reader/; the onlyfindis the outline's array lookup (pdf-outline.tsx:155).findTextMatches(core/document-text.ts:72, exact line), the agent's search operation consuming it (document-tools.ts:1,44,116), and PDFs explicitlytextReadable(create-reader-agent.ts:36).code-reader.tsx:49"foldable and searchable"); PDFs are not.lintpassed;verifyfails today → stays open.Verdict: valid, keep open — the strongest reuse story in the queue. The matcher, the per-page text, and even the interaction pattern (n of m, enter-to-step) all exist; nothing new needs inventing.
One anchor fix to make before implementation (this queue now has two closed-correctly-but-anchor-refused cases: #41, #55):
grep -rqi "search"guesses the vocabulary — a Cmd+F implementation named "Find" meets the Goal without the word "search". The one artifact any implementation must touch is the matcher the proposal itself mandates reusing:grep -rq "findTextMatches" ui-packages/web/src/components/pdf-readerbencode commentedon Oct 21, 2026
Re-audit — posted by the scheduled issue-reviewer loop (independent of the authoring session), against
main@ebb0ee0(25+ commits since the last review atd94348b).Evidence audit: every behavioral premise still holds; three citations drifted by refactor, not by removal.
components/pdf-reader/index.tsx:83still gates the text layer ontextReadyPage === pageNumber; still zero "search" incomponents/pdf-reader/(verify grep fails).findTextMatchesmoved fromcore/document-text.tstoutils/text.ts(withnormalizeSearchText) — the reuse story survives, the import is just shorter. The old file's test lives on asfeatures/assistant/document-text.test.tsx.features/agent/is nowfeatures/assistant/—document-tools.ts:44,66,116still exposes thesearchoperation consuming the matcher;create-reader-agent.tsstill marks PDFstextReadable.features/reader/code-reader.tsx:49-50"foldable and searchable";pdf-outline.tsx:155remains the onlyfind(array lookup).Verification block edited (logged here per policy, replacing the vocabulary-guessing grep this loop recommended last beat, after the #41/#55 anchor refusals):
The new anchor passes only when an implementation actually imports the mandated matcher into the PDF reader — any implementation naming. Re-linted ✓; verify fails on main today ✓ (not implemented).
Verdict: valid, keep open. Sensor: lint ✓, verify ✗. No new commits implement or invalidate the proposal.
bencode commentedon Oct 23, 2026
Re-audit — posted by the scheduled issue-reviewer loop (independent of the authoring session), against
main@90b046f(21 commits since the last review atebb0ee0).Evidence audit: nothing moved — none of the 21 commits (conversation numbers, composer refactor, background conversations, drag-tabs, resource-row actions) touches
components/pdf-reader/orutils/text.ts. Every anchor from the last re-audit holds as-is: the single-page gateindex.tsx:83(textReadyPage === pageNumber), the matcher atutils/text.ts:24, the assistantsearchop atfeatures/assistant/document-tools.ts:44,66,116, the precedent quote atcode-reader.tsx:49, and still zero "search" anywhere incomponents/pdf-reader/.Sensor: lint ✓, verify ✗ (not implemented).
Verdict: valid, keep open. No new commits implement or invalidate the proposal.
bencode commentedon Oct 27, 2026
Re-audit — posted by the scheduled issue-reviewer loop, independent of the authoring session, against
main@e8c930f(36 commits since the last review at90b046f).Evidence audit: of the 36 commits only
c706f8c(link/drop navigation staying in the reader) touches the PDF reader, and it is orthogonal to search. Every anchor from the last re-audit still holds to the line: the single-page gatecomponents/pdf-reader/index.tsx:83(textReadyPage === pageNumber), the matcherfindTextMatchesatutils/text.ts:24, the assistantsearchoperation atfeatures/assistant/document-tools.ts:44,66, thetextReadablecontract atdocument-tools.ts:38,94, the precedent quote atcode-reader.tsx:49("foldable and searchable") — and still zerosearch/findTextMatchesanywhere incomponents/pdf-reader/.Sensor: lint ✓, verify ✗ (not implemented on main).
Verdict: valid, keep open. No new commit implements or invalidates the proposal; the open+closed title scan still shows no duplicate.
bencode commentedon Nov 2, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Re-audit at
d05b6b6— the stalest review in the queue (15 commits since the last review @e8c930f, none touching a cited file:git diff --stat e8c930f..HEADovercomponents/pdf-reader/,utils/text.ts,features/assistant/document-tools.ts,code-reader.tsxis empty). Valid, stays open; no edits.pdf-reader/index.tsx:83(textReadyPage === pageNumber); matcherfindTextMatchesatutils/text.ts:24; the assistant's search operation atdocument-tools.ts:44,66with thetextReadablecontract at:38,94; the precedent quote atcode-reader.tsx:49("foldable and searchable"); still zerosearch/findTextMatchesincomponents/pdf-reader/non-test code — Ctrl+F still structurally sees one page.core/document-text.ts:72andfeatures/agent/document-tools.ts— both paths are gone; the real homes areutils/text.ts:24andfeatures/assistant/document-tools.ts:44,66. Known since earlier re-audits; repeated here so an implementer following the Refs verbatim doesn't chase ghosts.findTextMatchesgrep red incomponents/pdf-reader— red for the right reason). Gate healthy, one command per line.bencode commentedon Nov 13, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Re-audit (sixth pass) @
d05b6b6— HEAD still unchanged since 2026-10-28; valid, stays open; no edits.pdf-reader/index.tsx:83(textReadyPage === pageNumber); matcherfindTextMatchesatutils/text.ts:24; the assistant'ssearchoperation atdocument-tools.ts:44,66,116with its length guard; the precedent quote atcode-reader.tsx:49("foldable and searchable"); still zerosearch/findTextMatchesincomponents/pdf-reader/— Ctrl+F still structurally sees one page.core/document-text.ts:72andfeatures/agent/document-tools.ts— both paths are gone; the real homes areutils/text.ts:24andfeatures/assistant/document-tools.ts:44,66. Repeated so an implementer following the Refs verbatim doesn't chase ghosts.findTextMatchesgrep red incomponents/pdf-reader— red for the right reason). Gate healthy, one command per line.