Repository navigation
Add Cmd+F terminal search with case-sensitive option - #241
Conversation
- Add FIND_IN_TERMINAL hotkey (meta+f) to hotkeys.ts - Create TerminalSearch component using xterm search addon - Support case-sensitive toggle with tooltip - Only trigger search in focused terminal - Remove unused HotkeyModal component 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded@AviPeltz has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 27 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughThis PR removes the HotkeyModal component and its export, and adds an xterm.js-powered terminal search: Terminal now loads and manages a SearchAddon, supports Cmd/Ctrl+F to open a new TerminalSearch UI, and a FIND_IN_TERMINAL hotkey was added to shared hotkeys. Changes
Sequence DiagramsequenceDiagram
participant User
participant Terminal
participant TerminalSearch
participant SearchAddon
User->>Terminal: Focus terminal pane
Terminal->>Terminal: set isFocused = true
User->>Terminal: Press Cmd/Ctrl+F
Terminal->>Terminal: detect shortcut -> set isSearchOpen = true
Terminal->>TerminalSearch: render with searchAddon & isOpen=true
TerminalSearch->>TerminalSearch: auto-focus input
User->>TerminalSearch: Type query
TerminalSearch->>SearchAddon: find(query, caseSensitive)
SearchAddon-->>TerminalSearch: matchCount / highlights
User->>TerminalSearch: Press Enter / Shift+Enter
TerminalSearch->>SearchAddon: findNext() / findPrevious()
SearchAddon-->>TerminalSearch: highlight match in terminal
User->>TerminalSearch: Press Esc or close
TerminalSearch->>SearchAddon: clearDecorations()
TerminalSearch->>Terminal: onClose callback
Terminal->>Terminal: set isSearchOpen = false
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
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: 0
🧹 Nitpick comments (3)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsx (2)
29-29: Consider renamingmatchCountto clarify its purpose.The variable name
matchCountsuggests a numeric count of matches, but it's actually used as a tri-state indicator (1 = found, 0 = not found, null = empty). The xterm SearchAddon doesn't provide actual match counts, only boolean found/not-found results.Consider renaming to
searchResultorhasMatchwith a boolean type:-const [matchCount, setMatchCount] = useState<number | null>(null); +const [hasMatch, setHasMatch] = useState<boolean | null>(null);Then update the corresponding usage throughout the file (lines 67, 78, 80, 93, 113, 130-132).
90-95: Remove redundantquerydependency to prevent duplicate searches.The effect re-runs the search when
querychanges, buthandleInputChange(lines 72-83) already performs the search on every keystroke. This causes the search to execute twice per character typed—once in the input handler and once in the effect.Remove
queryfrom the dependency array since the effect's purpose is to re-run the search only when case sensitivity changes:useEffect(() => { if (searchAddon && query) { const found = searchAddon.findNext(query, searchOptions); setMatchCount(found ? 1 : 0); } - }, [caseSensitive, searchAddon, query, searchOptions]); + }, [caseSensitive, searchAddon, searchOptions]);Note:
searchOptionsalready depends oncaseSensitive, so you could simplify further to[searchOptions, searchAddon], but the current form is more explicit.apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx (1)
128-132: Consider guarding against race condition in async addon loading.If the component unmounts before the dynamic import completes,
searchAddonRef.currentwill be set after cleanup. While this is a minor issue (the ref will eventually be garbage collected), a more robust approach would check if the component is still mounted.Add a mounted flag to guard the async operation:
+ let mounted = true; + // Load search addon for Cmd+F functionality import("@xterm/addon-search").then(({ SearchAddon }) => { + if (!mounted) return; const searchAddon = new SearchAddon(); xterm.loadAddon(searchAddon); searchAddonRef.current = searchAddon; }); // ... rest of effect return () => { + mounted = false; inputDisposable.dispose(); cleanupFocus?.(); // ... rest of cleanupThis is optional and may be overkill for this use case.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
apps/desktop/src/renderer/components/HotkeyModal/HotkeyModal.tsx(0 hunks)apps/desktop/src/renderer/components/HotkeyModal/index.ts(0 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx(6 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsx(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/index.ts(1 hunks)apps/desktop/src/shared/hotkeys.ts(1 hunks)
💤 Files with no reviewable changes (2)
- apps/desktop/src/renderer/components/HotkeyModal/index.ts
- apps/desktop/src/renderer/components/HotkeyModal/HotkeyModal.tsx
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
For Electron interprocess communication, ALWAYS use tRPC as defined in
src/lib/trpc
Files:
apps/desktop/src/shared/hotkeys.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/index.ts
apps/desktop/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
apps/desktop/**/*.{ts,tsx}: Please use alias as defined intsconfig.jsonwhen possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary
Files:
apps/desktop/src/shared/hotkeys.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid usinganytype - use explicit types instead for type safety
Use camelCase for variable and function names following existing codebase patterns
Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Follow existing patterns and match the codebase style when writing new code
Files:
apps/desktop/src/shared/hotkeys.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/index.ts
**/components/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
**/components/**/*.tsx: Create one folder per component with structure:ComponentName/ComponentName.tsx+index.tsfor barrel export
Co-locate tests next to the component file they test (e.g.,ComponentName.test.tsx)
Co-locate dependencies (utils, hooks, constants, config, stories) next to the file using them
Use nestedcomponents/subdirectory within a parent component only if a sub-component is used 2+ times within that parent; otherwise keep it in the parent'scomponents/folder
One component per file - avoid multi-component files
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules (fs, path, os, net, etc.) in renderer process code - browser environment only
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/index.ts
apps/desktop/src/renderer/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Call IPC methods using
window.ipcRenderer.invoke()with object parameters - TypeScript will infer the exact response type automatically
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsx
🧠 Learnings (2)
📚 Learning: 2025-11-28T01:03:47.963Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.963Z
Learning: Applies to **/*.{ts,tsx} : Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Applied to files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx
📚 Learning: 2025-11-24T21:33:13.267Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.267Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible
Applied to files:
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/index.ts
🧬 Code graph analysis (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsx (1)
packages/ui/src/components/tooltip.tsx (3)
Tooltip(74-74)TooltipTrigger(74-74)TooltipContent(74-74)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
🔇 Additional comments (13)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/index.ts (1)
1-1: LGTM! Follows component structure guidelines.The barrel export follows the prescribed pattern of
index.tsexporting fromComponentName.tsx.apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/TerminalSearch/TerminalSearch.tsx (4)
1-11: LGTM! Clean imports and type definitions.The props interface correctly handles the nullable
searchAddonto account for async addon loading, and all imports are well-organized.
13-20: LGTM! Well-defined search decoration theme.The decoration colors appropriately distinguish between regular matches and the active match for good UX.
56-115: LGTM! Event handlers are well-implemented.The handlers correctly manage search navigation, input changes, case sensitivity toggling, and keyboard shortcuts. The null checks for
searchAddonandqueryprevent errors during async loading.
117-177: LGTM! Well-structured search UI with good accessibility.The UI provides clear visual feedback and includes helpful tooltips and title attributes for all interactive elements. The absolute positioning and backdrop blur create good visual separation from the terminal content.
apps/desktop/src/shared/hotkeys.ts (1)
106-111: LGTM! Well-integrated hotkey definition.The new
FIND_IN_TERMINALhotkey follows the existing pattern and is appropriately categorized. Themeta+fbinding intentionally overrides the browser's default find behavior to provide terminal-specific search functionality, which aligns with the PR objectives.apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/Terminal.tsx (7)
3-3: LGTM! Clean imports for search integration.All imports are appropriately typed and follow the codebase patterns. The type-only import for
SearchAddonon line 3 is correct for the initial type annotation.Also applies to: 6-6, 10-10, 18-18
31-31: LGTM! Appropriate refs and state for search integration.The
searchAddonRefstores the addon instance, andisSearchOpentracks visibility—both are correctly implemented for the search feature.Also applies to: 35-35
105-112: LGTM! Properly scoped hotkey handler.The hotkey is correctly restricted to the focused terminal via
enabled: isFocused, preventing multiple terminals from responding to the same shortcut. The dependency array is appropriate.
255-255: LGTM! Proper cleanup of search addon reference.Resetting the ref to null prevents stale references after terminal disposal. The addon itself is automatically disposed by
xterm.dispose()on line 253.
300-300: LGTM! Required positioning for search overlay.The
relativeclass is necessary for the absolutely positionedTerminalSearchcomponent to anchor correctly within the terminal container.
305-309: LGTM! Proper integration of search component.The
TerminalSearchcomponent is correctly wired with the addon reference, visibility state, and close callback. The rendering order ensures the search UI overlays the terminal content.
37-43: No issues found—focusedPaneIdsis the correct, intentional API.The plural form
focusedPaneIdsis aRecord<string, string>(map of windowId → paneId) as defined in the store types and documented with the comment "last focused pane in each window". All usages across the codebase consistently follow this pattern. This is the proper design for multi-window architectures, not an undocumented API change.
Add isUnmounted flag to prevent loading addon on disposed xterm instance if the terminal unmounts before the dynamic import resolves. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Match app styling by using Button with ghost variant and icon-sm size. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- More compact layout with smaller icons and padding - Subtler border and background opacity - Grouped action buttons with separator - Adjusted positioning (top-3 right-4) - Smoother hover transitions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Prevent Electron's native find overlay with preventDefault - Auto-close search when terminal loses focus - Refine search bar styling with better hover states - Fix pane close button: tighter padding with circular highlight - Remove unused Button import from WindowPane - Remove redundant dependency in useEffect 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with Claude Code
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit
New Features
Removed
✏️ Tip: You can customize this high-level summary in your review settings.