Skip to content

Add find and replace in SQL editor (#35)#43

Open
muk2 wants to merge 2 commits intomainfrom
feature/issue-35-find-replace
Open

Add find and replace in SQL editor (#35)#43
muk2 wants to merge 2 commits intomainfrom
feature/issue-35-find-replace

Conversation

@muk2
Copy link
Owner

@muk2 muk2 commented Feb 19, 2026

Summary

  • Adds Ctrl+F to open a find bar and Ctrl+H to open find & replace in the query editor
  • Live search with real-time match highlighting as you type
  • Current match highlighted in yellow, other matches in blue
  • Navigate between matches with Enter/Shift+Enter or Up/Down arrows
  • Replace current match by pressing Enter in replace field, replace all with Ctrl+Shift+Enter
  • Toggle case sensitivity with Ctrl+C while in find mode
  • Pre-fills search text from current editor selection

Changes

  • src/ui/app.rs: Added FindReplaceState struct and FindReplaceField enum, find/replace state to App, input handler for find/replace mode, search/navigation/replace methods, 15 unit tests
  • src/ui/components.rs: Added draw_find_bar() function, updated draw_editor() to render find bar above editor content, added match highlighting to syntax highlighter, added shortcuts to help overlay

Test plan

  • All 231 tests pass (15 new find/replace tests)
  • cargo build compiles without warnings
  • Manual: Press Ctrl+F in editor, type search text, verify matches highlight
  • Manual: Press Enter to cycle through matches, Shift+Enter for reverse
  • Manual: Press Ctrl+H, type replacement, press Enter to replace one occurrence
  • Manual: Press Ctrl+Shift+Enter to replace all occurrences
  • Manual: Select text in editor, press Ctrl+F, verify search pre-filled
  • Manual: Press Esc to close find bar

Closes #35

🤖 Generated with Claude Code

muk2 and others added 2 commits February 19, 2026 22:44
Implements Ctrl+F (Find) and Ctrl+H (Find & Replace) in the editor (#35):
- Inline find bar with live search as you type
- Case-sensitive toggle with Ctrl+C in find mode
- Match highlighting: current match in yellow, other matches in blue
- Navigate matches with Enter/Shift+Enter or Up/Down arrows
- Replace current match (Enter in replace field)
- Replace all occurrences (Ctrl+Shift+Enter)
- Pre-fills search with selected text when opening
- Tab to switch between search and replace fields
- Esc to close find bar
- 15 unit tests covering search, navigation, and replacement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Resolve merge conflicts in app.rs and components.rs keeping both
  find/replace feature and autocomplete additions from main
- Fix clippy::if_same_then_else in update_find_matches by combining conditions
- Run cargo fmt for consistent formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Feature: Find and Replace in SQL editor

1 participant