Repository navigation
Native chat: Cmd/Ctrl+F finds in the chat - #26517
Conversation
Mod+F inside a focused native chat opens a find bar at the chat's top-right corner. The bar is a separate sandboxed view stacked over the main window, so its own input is never a match; main runs the window's find-in-page and relays the match count back. Enter/Shift+Enter step, Escape closes and clears. Also stops the terminal search bar from opening over a chat that covers a terminal pane.
Replaces the window-level find panel with a find bar inside the chat. The panel searched the whole window, pasted into the composer, outlived its chat, and let Escape interrupt the agent. - Searches only the transcript text the reader can see and paints matches with CSS highlights, reusing the markdown preview's search, now shared as lib/dom-text-search-highlights.ts. - Re-searches as the transcript streams or scrolls, keeping the current match; a step leaves "follow latest" like a reader scroll. - Escape closes the bar first and returns focus; paste and editing keys stay in the bar's input. - Terminal guard yields any chat.find chord inside a chat cover; a PDF no longer takes Mod+F from another surface.
- Escape: the chat root's React capture handler closes the bar before the composer's own capture handler can interrupt the turn. - One visibility rule for picking and revealing a match: typing no longer scrolls to a match that is already on screen, and the bar's real rect, not a full-width band, decides what it covers. - Reveal scrolls nested scroll boxes (code lines, tool output, thinking); text cut off by a box that cannot scroll is not counted. - PDF find opens from its own tab and the file explorer again, but not from another group, a chat, or a text field. - Prompt cards no longer take focus from the find input; clicks on the bar keep typing in it; buttons keep their own Enter. - A match whose row scrolled away restarts from the first visible match. - Streamed text growth re-searches every 120 ms instead of every frame, and searches reuse their Range objects. - Hover-only row chrome is marked and skipped instead of read by opacity. - Chat find stays off in the web client, where the browser's find keeps Mod+F. - The text matcher moves to lib/text-match-ranges.ts with neutral names.
- Text that held a match re-searches before the next paint: React rewrites a growing text node whole, collapsing its ranges, so the streaming paragraph's highlights no longer blink. Other text growth keeps the 120 ms re-search. - A disclosure's height animation ending re-searches, so an output opened while find is open is counted. - A prompt card that arrived while the find bar held focus gets it when find closes. - A reveal that cannot scroll no longer stops following the latest. - PDF find follows the panel's chord owner (its tab is the active tab of the focused group, the rule the browser pane uses), so it no longer takes Mod+F from a chat, terminal or browser in another split, and it opens again after clicking its own editor header.
The floating workspace panel keeps its own focused group, so a PDF that owns its panel's chords no longer takes Mod+F from a chat in the other surface (main window vs floating panel), matching how the browser pane scopes a floating workspace's chords.
Review summaryThe problem: in a native chat, Cmd/Ctrl+F did nothing. In a terminal tab shown as a chat, it opened the terminal's search over the chat, and that search looked through the hidden terminal text, not the conversation. What changes for you: Cmd/Ctrl+F in a chat opens a find bar inside the chat:
The design changed during reviewThe first version put the bar in a separate floating panel over the window and used the browser's whole-page search. Round 1 showed that this doesn't fit a chat inside Orca's multi-pane window:
The maintainer chose the cleanest fix: a bar that lives in the chat and searches only the conversation. It reuses Orca's markdown-preview search-and-highlight code, which moves into a shared module and behaves the same as before. The floating panel, its preload script and its main-process code are all removed. What review fixed (5 rounds plus a readiness pass)
Deferred (not blocking)
What was verified
Not verified
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe change adds native chat transcript search with a find bar, match highlighting, result navigation, and match scrolling. It adds the Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Chat find looks ready to merge. One small open question remains for PDFs: when two PDF viewers share a workspace surface, pressing Cmd/Ctrl+F may open find in both. Confirm or fix that as a follow-up. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
fa250770-8f04-4feb-a8b9-e6932e5a1eb3
📒 Files selected for processing (39)
src/renderer/src/components/editor/EditorPanel.tsxsrc/renderer/src/components/editor/PdfViewer.tsxsrc/renderer/src/components/editor/editor-shortcut-owner.tssrc/renderer/src/components/editor/markdown-preview-search.tssrc/renderer/src/components/editor/use-pdf-viewer-shortcuts.test.tsxsrc/renderer/src/components/editor/use-pdf-viewer-shortcuts.tssrc/renderer/src/components/native-chat/NativeChatApprovalCard.tsxsrc/renderer/src/components/native-chat/NativeChatFindBar.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.reader-navigation.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.tsxsrc/renderer/src/components/native-chat/NativeChatMessageRow.tsxsrc/renderer/src/components/native-chat/NativeChatQuestionCard.tsxsrc/renderer/src/components/native-chat/NativeChatResolvedView.reveal-latest.test.tsxsrc/renderer/src/components/native-chat/NativeChatResolvedView.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.test-harness.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.tsxsrc/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsxsrc/renderer/src/components/native-chat/native-chat-find-visibility.test.tssrc/renderer/src/components/native-chat/native-chat-find-visibility.tssrc/renderer/src/components/native-chat/native-chat-find.csssrc/renderer/src/components/native-chat/native-chat-reader-scroll-input.tssrc/renderer/src/components/native-chat/use-native-chat-find-matches.tssrc/renderer/src/components/native-chat/use-native-chat-find.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-find.tssrc/renderer/src/components/native-chat/use-native-chat-prompt-card-focus.tssrc/renderer/src/components/native-chat/use-native-chat-reveal-latest.tssrc/renderer/src/components/native-chat/use-structured-native-chat-submit-reveal.test.tssrc/renderer/src/components/terminal-pane/terminal-keyboard-event-handlers.tssrc/renderer/src/components/terminal-pane/terminal-keyboard-native-chat-find.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/dom-text-search-highlights.tssrc/renderer/src/lib/text-match-ranges.tssrc/shared/keybindings/definitions-core-4.tssrc/shared/keybindings/types.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| return ( | ||
| ownsShortcuts && | ||
| !isEditableTarget(target instanceof Element ? target : null) && | ||
| isEventTargetInsideFloatingWorkspacePanel(target) === | ||
| isEventTargetInsideFloatingWorkspacePanel(root) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Inspect PDF viewer call sites and their surrounding panel layout.
rg -n -C 8 --glob '*.{ts,tsx}' \
'<PdfViewer\b|EditorShortcutOwnerContext\.Provider' \
src/renderer/src/components/editorRepository: stablyai/orca
Length of output: 41363
🏁 Script executed:
set -eu
printf '%s\n' '--- shortcut implementation ---'
nl -ba src/renderer/src/components/editor/use-pdf-viewer-shortcuts.ts | sed -n '1,180p'
printf '%s\n' '--- production PdfViewer call sites ---'
rg -n -F --glob '*.{ts,tsx}' --glob '!*.test.*' '<PdfViewer' src/renderer/src
printf '%s\n' '--- owner context declarations/usages ---'
rg -n -C 6 -F --glob '*.{ts,tsx}' --glob '!*.test.*' 'EditorShortcutOwnerContext' src/renderer/src
printf '%s\n' '--- ImageViewer logical block ---'
nl -ba src/renderer/src/components/editor/ImageViewer.tsx | sed -n '1,270p'
printf '%s\n' '--- EditorPanel composition ---'
nl -ba src/renderer/src/components/editor/EditorPanel.tsx | sed -n '280,390p'Repository: stablyai/orca
Length of output: 26201
🏁 Script executed:
set -eu
nl -ba src/renderer/src/components/editor/use-pdf-viewer-shortcuts.ts | sed -n '1,180p'
rg -n -F --glob '*.{ts,tsx}' --glob '!*.test.*' '<PdfViewer' src/renderer/src
rg -n -C 6 -F --glob '*.{ts,tsx}' --glob '!*.test.*' 'EditorShortcutOwnerContext' src/renderer/src
nl -ba src/renderer/src/components/editor/ImageViewer.tsx | sed -n '1,270p'
nl -ba src/renderer/src/components/editor/EditorPanel.tsx | sed -n '280,390p'Repository: stablyai/orca
Length of output: 26021
🏁 Script executed:
set -eu
printf '%s\n' '--- ImageViewer production call sites ---'
rg -n -C 12 -F --glob '*.{ts,tsx}' --glob '!*.test.*' '<ImageViewer' src/renderer/src
printf '%s\n' '--- diff/conflict viewer references ---'
rg -n -C 8 -i --glob '*.{ts,tsx}' --glob '!*.test.*' 'diff|conflict' src/renderer/src/components/editor | rg -n 'ImageViewer|Preview|Viewer|EditorPanelShell|sideBySide|conflict' || true
printf '%s\n' '--- EditorPanelShell declaration and viewer-related blocks ---'
rg -n -F --glob '*.{ts,tsx}' 'function EditorPanelShell|const EditorPanelShell|export default function EditorPanelShell|ImageViewer|sideBySide|Diff' src/renderer/src/components/editorRepository: stablyai/orca
Length of output: 43324
🏁 Script executed:
set -eu
rg -n -C 12 -F --glob '*.{ts,tsx}' --glob '!*.test.*' '<ImageViewer' src/renderer/src
rg -n -C 8 -i --glob '*.{ts,tsx}' --glob '!*.test.*' 'diff|conflict' src/renderer/src/components/editor | rg -n 'ImageViewer|Preview|Viewer|EditorPanelShell|sideBySide|conflict' || true
rg -n -F --glob '*.{ts,tsx}' 'function EditorPanelShell|const EditorPanelShell|export default function EditorPanelShell|ImageViewer|sideBySide|Diff' src/renderer/src/components/editorRepository: stablyai/orca
Length of output: 42547
🏁 Script executed:
set -eu
printf '%s\n' '--- EditorDiffFileSurface ---'
nl -ba src/renderer/src/components/editor/EditorDiffFileSurface.tsx | sed -n '1,190p'
printf '%s\n' '--- EditorContent viewer branches ---'
rg -n -C 14 -F --glob '*.{ts,tsx}' --glob '!*.test.*' 'EditorDiffFileSurface|ImageDiffViewer|EditorEditFileSurface' src/renderer/src/components/editor
printf '%s\n' '--- isCmdSaveOwner definition and surrounding logic ---'
rg -n -C 12 -F --glob '*.tsx' 'isCmdSaveOwner' src/renderer/src/components/editorRepository: stablyai/orca
Length of output: 8150
🏁 Script executed:
set -eu
nl -ba src/renderer/src/components/editor/EditorDiffFileSurface.tsx | sed -n '1,190p'
rg -n -C 14 -F --glob '*.{ts,tsx}' --glob '!*.test.*' 'EditorDiffFileSurface|ImageDiffViewer|EditorEditFileSurface' src/renderer/src/components/editor
rg -n -C 12 -F --glob '*.tsx' 'isCmdSaveOwner' src/renderer/src/components/editorRepository: stablyai/orca
Length of output: 8082
🏁 Script executed:
printf '%s\n' '--- isCmdSaveOwner references ---'
rg -n -C 14 -F --glob '*.tsx' 'isCmdSaveOwner' src/renderer/src/components/editor || true
printf '%s\n' '--- diff surface references ---'
rg -n -C 18 -F --glob '*.{ts,tsx}' --glob '!*.test.*' 'EditorDiffFileSurface' src/renderer/src/components/editor || true
printf '%s\n' '--- candidate content files ---'
rg --files src/renderer/src/components/editor | rg 'Editor(Content|PanelShell)|editor-content|editor-panel-shell'Repository: stablyai/orca
Length of output: 18680
🏁 Script executed:
set -eu
rg -n -C 18 -F --glob 'PdfViewer.tsx' 'rootRef' src/renderer/src/components/editor/PdfViewer.tsx
rg -n -C 18 -F --glob 'PdfViewer.tsx' 'ref={rootRef}' src/renderer/src/components/editor/PdfViewer.tsxRepository: stablyai/orca
Length of output: 5212
🏁 Script executed:
set -eu
rg -n -C 18 -F 'rootRef' src/renderer/src/components/editor/PdfViewer.tsx
rg -n -C 18 -F 'ref={rootRef}' src/renderer/src/components/editor/PdfViewer.tsxRepository: stablyai/orca
Length of output: 5212
Exclude targets inside another PDF root before the outside-root fallback.
A visible binary diff renders two PdfViewer instances under the same owning panel. A key event inside one viewer can therefore pass the fallback for the other viewer. Both find bars can open because each viewer has its own window listener.
Mark each PDF root and reject targets that belong to a different PDF root before applying the panel fallback.
🐛 Suggested fix
- return (
+ const targetPdfRoot =
+ target instanceof Element ? target.closest('[data-pdf-viewer-root]') : null
+ if (targetPdfRoot && targetPdfRoot !== root) {
+ return false
+ }
+ return (
ownsShortcuts &&- <div ref={rootRef} className="flex h-full min-h-0 flex-col">
+ <div
+ ref={rootRef}
+ data-pdf-viewer-root
+ className="flex h-full min-h-0 flex-col"
+ >Resolve EditorPanel and PdfViewer: use main's EditorCommandOwnerContext for the PDF find gate (drop our duplicate editor-shortcut-owner context), keep main's zoom handling, and reduce use-pdf-viewer-shortcuts to use-pdf-viewer-find-shortcut.
|
Merged main into the branch (e54452c) to resolve conflicts in Main's #26652 had added the same "focused editor pane owns app commands" context that this PR had added for PDF find, and moved PDF zoom to that owner:
Both typechecks, 291 targeted tests (including main's new PDF zoom and ownership tests) and |
Main split the message row into user and assistant rows: re-apply the find skip on the user meta row in NativeChatUserMessageRow. Main's streamed replies wrap each fading word in its own span: find joins a word group's text so phrases match while words fade in, and treats words drawn into a group as text growth (throttled) unless a removed word held a match.
ELI5
In a native chat, pressing Cmd+F (Ctrl+F on Windows and Linux) now opens a small find bar inside the chat. Type a word and the matching text in the conversation is highlighted, with a count like "2/5". Enter goes to the next match, Shift+Enter to the previous one, and Escape closes the bar and puts you back where you were typing.
What Changed
Before
After
Limits
How it works
lib/dom-text-search-highlights.ts) that both use. The markdown preview behaves exactly as before.Why
The first version of this PR showed the bar as a separate floating panel over the window and used the browser's page search. Review found that this didn't fit a chat inside Orca's multi-pane window:
A find bar that lives in the chat and searches only the conversation avoids all of these. It also reuses search code Orca already had for the markdown preview, instead of adding a second window, a preload script and new messages between processes.
Differences from the common pattern, a window-wide find bar in its own view:
Linked Issue
N/A (maintainer request)
Visual Proof
Before: Cmd/Ctrl+F in a chat tab did nothing, so there is nothing to capture.
After (Orca dev build on macOS, hidden window, a seeded 64-turn chat with "pelican" 12 times and a workspace named
pelican-flamingo-repo):Testing
New unit tests cover:
Existing markdown preview, PDF find, chat scroll and keybinding suites pass.
pnpm tc:web,pnpm tc:nodeandorca-ci-checks(22/22) pass.Live QA in an Orca dev build on macOS (hidden window, isolated profile, stand-in agent), at 5273a07, passed:
Not checked live: Windows and Linux, a terminal tab in chat view, an approval card arriving while find is open (covered by unit tests), and a real streaming reply.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
A review summary will be posted as a comment.
Agent skill upstream boundary
Notes
Author: @BrennanKB5