feat(desktop): add Cmd+F search to v2 changes pane

Closed
AV
4mo ago
+202-237

Summary

Adds Cmd+F (Ctrl+Shift+F on Windows/Linux) text search to the v2 changes (diff) pane, matching the existing find-in-terminal / find-in-chat / find-in-file-viewer experience.

  • New FIND_IN_DIFF hotkey in the renderer hotkey registry (⌘F mac, Ctrl+Shift+F win/linux), gated to the active diff pane.
  • New useDiffPaneSearch hook that wraps the shared useTextSearch engine, searching across each file's @pierre/diffs shadow root via getDiffSearchRoots and auto-closing when the pane loses focus.
  • DiffPane now wraps CodeView in a relative container and renders the existing MarkdownSearch overlay (input, X of Y match count, case toggle, prev/next, Esc to close; Enter / Shift+Enter to navigate).

Known limitation

CodeView is virtualized, so off-screen lines aren't in the DOM. Matches are scoped to currently rendered/expanded content and the count updates as you scroll — the same trade-off the shipped v1 diff/chat search makes. Collapsed files are naturally excluded. A stable total count + jump-to-off-screen would require a data-driven search with scrollTo navigation (possible follow-up).

Test Plan

  • Open the Changes pane in a v2 workspace, press ⌘F, type a query, and confirm matches highlight with a X of Y count.
  • Enter / Shift+Enter cycle through matches; case toggle works; Esc closes.
  • Search closes automatically when focus leaves the diff pane.
  • bun run lint and bun run typecheck pass.

Open in Stage

Summary by cubic

Adds Cmd+F (Ctrl+Shift+F on Windows/Linux) search to the v2 Changes pane. Uses the shared find UI with match highlighting, X of Y, case toggle, Enter/Shift+Enter navigation, and Esc to close.

  • New Features

    • Added FIND_IN_DIFF hotkey scoped to the active changes pane.
    • DiffPane mounts MarkdownSearch and uses useDiffPaneSearch (via useFindHotkeySearch) to search inside @pierre/diffs shadow roots; auto-closes on focus loss.
    • Limitation: CodeView is virtualized, so only visible/expanded lines are searchable; counts update as you scroll.
  • Refactors

    • Extracted useFindHotkeySearch to standardize Cmd+F behavior (toggle, auto-close, file-change reset).
    • Migrated chat and file viewer search hooks to useFindHotkeySearch.

Summary by CodeRabbit

  • New Features

    • In-pane Markdown search added to the diff view with Cmd/Ctrl+F support, case-sensitive matching, and next/previous navigation.
    • A new platform-aware "Find in diff" hotkey is available.
  • Refactor

    • Search behavior unified into a shared find-hotkey system and applied to file viewer, markdown, and chat panes for consistent UX.

Review Change Stack