Skip to content

feat(app): Cmd+F find in Preview PDFs (S1) - #1720

Open
jacktrnr wants to merge 1 commit into
mainfrom
feat/pdf-find-s1
Open

jacktrnr wants to merge 1 commit into
mainfrom
feat/pdf-find-s1

Conversation

@jacktrnr

@jacktrnr jacktrnr commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

S1 of Cmd+F find in Preview PDFs — the vertical slice. Cmd+F on a focused PDF pane opens a find pill, highlights every match, and steps through them.

  • Find core (pdf-find-core.ts): walks the pdf.js text layer into a normalized searchable string + DOM offset map. Handles hyphen-line-break joins, whitespace collapse, NFKC (ligatures), per-page tagging.
  • Painter (pdf-find-highlight.ts): CSS Custom Highlight API only — never mutates the DOM, so selection/copy/links are untouched.
  • Controller (pdf-find-controller.ts): per-pane state, lazy index, debounced query, pane-scoped scroll (never scrollIntoView).
  • Pill (pdf-find-pill.tsx): floating find bar in the preview controls; exempt from idle auto-hide.
  • Routing + guard (pdf-find-guard.ts, session-preview-tab.tsx, entry.tsx): focus-based Cmd+F routing; a boot-time guard preventDefaults the key inside a PDF pane so upstream file-find (which captures Cmd+F whenever a diff/tool card is mounted) can't hijack it — stopPropagation is never called, so the command registry still fires.

Test plan

  • Unit: 73/73 pass (bun test src/components/session/ in the app package), incl. 28 new find-core tests.
  • Typecheck: clean (tsgo).
  • Materialize + drift gate: PASS.
  • Verified live: rebuilt locally, opened a PDF in Preview, Cmd+F → pill opens, matches highlight, Enter steps, Esc closes.
  • Pending: Playwright e2e (needs dev server) — tracked as a follow-up.

Part of the "Find in Preview" design (parent issue draft in scratchpad). S2–S4 (options, recompile survival, markdown) come next.

…m Highlight painting, focus routing + hijack guard
@jacktrnr jacktrnr self-assigned this Oct 5, 2026
@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ee88556d-d18c-4254-b39e-ce84a8695f36
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant