Skip to content

Comprehensive ripgrep search dialog with full option wiring#20

Merged
bluestreak01 merged 1 commit intomasterfrom
vi_rg
Apr 16, 2026
Merged

Comprehensive ripgrep search dialog with full option wiring#20
bluestreak01 merged 1 commit intomasterfrom
vi_rg

Conversation

@bluestreak01
Copy link
Copy Markdown
Member

@bluestreak01 bluestreak01 commented Apr 16, 2026

Summary

  • Expands the file search dialog (Ctrl+S) from 4 options to ~30, covering nearly all rg CLI flags
  • Wires every option to the underlying grep-regex / grep-searcher / ignore library builders
  • Adds auto-complete for file type fields, F1 contextual help on every field, and type-to-filter within search results
  • Implements custom Sink for before/after context line support
  • 48 tests covering every search option, edge cases, filter, and state management

What changed

Dialog (Ctrl+S)

Section Fields
Inputs pattern (-e), replace (-r), path, glob (-g), type (-t), type-not (-T)
Search options regex, case insensitive (-i), smart case (-S), word regexp (-w), line regexp (-x), invert match (-v), multiline (-U), multiline dot-all, CRLF
Filter options hidden (-.), follow symlinks (-L), no-ignore, binary as text (-a), search zip (-z), glob case insensitive, one file system, trim whitespace
Limits before context (-B), after context (-A), max depth (-d), max count (-m), max filesize, encoding (-E)

All fields show their rg short flag in the label. Every option persists across sessions.

Auto-complete & F1 help

  • Typing in -t type / -T type-not fields shows a dropdown of matching rg file types (~100 types from ignore::TypesBuilder)
  • F1 on any field shows contextual help popup with the rg flag, description, and usage examples
  • F1 on type fields → scrollable/filterable type list; F1 on glob → glob pattern reference

Search engine (SearchConfig → builders)

  • RegexMatcherBuilder: case_insensitive, case_smart, word, whole_line, multi_line, dot_matches_new_line, crlf, fixed_strings
  • SearcherBuilder: invert_match, multi_line, before/after_context, binary_detection, encoding, line_terminator
  • WalkBuilder: hidden, git_ignore, follow_links, max_depth, max_filesize, same_file_system, ignore_case_insensitive
  • TypesBuilder: select/negate per comma-separated type
  • Custom Sink implementation captures both match and context lines
  • parse_filesize with K/M/G suffixes and checked_mul overflow protection

Search results panel

  • Context lines rendered dimmer (space separator instead of colon)
  • Type to filter results in real-time (case-insensitive, matches text and file paths)
  • F4 / Enter opens editor at match line; editor close restores focus to search panel
  • Help dialog updated with new keybindings

Test plan

  • cargo check — compiles
  • cargo fmt --check — formatted
  • cargo clippy -- -W clippy::all — no warnings
  • cargo test — 48 tests pass (all search options, filter, state, edge cases)
  • Manual: Ctrl+S, configure options, verify results in opposite panel
  • Manual: F1 on each field, auto-complete on type fields
  • Manual: Type to filter results, Esc clears filter, F4 opens editor and returns to results

🤖 Generated with Claude Code

Expand the file search dialog (Ctrl+S) from a minimal 4-option form into a
full ripgrep configuration interface exposing ~30 rg CLI options, wire all
options to the grep-regex/grep-searcher/ignore library builders, and add
interactive features for discoverability and usability.

Dialog form:
- 6 text inputs: pattern (-e), replace (-r), path, glob (-g), type (-t),
  type-not (-T) with rg flag labels on every field
- 9 search checkboxes: regex, case insensitive (-i), smart case (-S),
  word regexp (-w), line regexp (-x), invert match (-v), multiline (-U),
  multiline dot-all, CRLF
- 8 filter checkboxes: hidden (-.), follow symlinks (-L), no-ignore,
  binary as text (-a), search zip (-z), glob case insensitive,
  one file system, trim whitespace
- 6 limit inputs: before context (-B), after context (-A), max depth (-d),
  max count (-m), max filesize, encoding (-E)
- All options persist across sessions via state.rs

Auto-complete and contextual help:
- File type fields (-t/-T) show auto-complete dropdown as you type,
  sourced from ignore::TypesBuilder defaults (~100 types)
- F1 on any field shows contextual help with rg flag, description,
  and usage examples
- F1 on type fields shows scrollable/filterable type list
- F1 on glob field shows glob pattern reference

Search engine wiring (SearchConfig → builders):
- RegexMatcherBuilder: case_insensitive, case_smart, word, whole_line,
  multi_line, dot_matches_new_line, crlf, fixed_strings
- SearcherBuilder: invert_match, multi_line, before_context, after_context,
  binary_detection, encoding, line_terminator (CRLF)
- WalkBuilder: hidden, git_ignore, follow_links, max_depth, max_filesize,
  same_file_system, ignore_case_insensitive
- TypesBuilder: select/negate per comma-separated type name
- OverrideBuilder: comma-separated glob patterns
- Custom Sink impl for before/after context line capture
- Manual max_count enforcement in sink callback
- Trim whitespace in sink callback
- parse_filesize helper with K/M/G suffixes and checked_mul overflow safety

Search results panel:
- Context lines rendered dimmer with space separator instead of colon
- Type-to-filter within results (case-insensitive, matches text and paths)
- Path-matching filter shows all file's matches
- F4/Enter opens editor at match line
- Editor close restores focus to search panel via pre_editor_focus tracking
- Help dialog updated with filter/F4 keybindings

Test coverage (48 tests):
- Every rg option tested: regex, literal, case insensitive, smart case,
  word/line regexp, invert match, multiline, multiline dotall, CRLF,
  glob include/exclude/comma-separated, file type select/multiple/negate,
  hidden files, gitignore, no-ignore, max depth, max count, max filesize,
  trim whitespace, follow symlinks, before/after context
- parse_filesize: bytes, K/M/G, empty, invalid, overflow
- SearchState: lifecycle, navigation, cancel-on-drop
- Filter: by text, by path, empty, clamp, case insensitive
- rg_file_types populated

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bluestreak01 bluestreak01 merged commit 3721626 into master Apr 16, 2026
4 checks passed
@bluestreak01 bluestreak01 deleted the vi_rg branch April 16, 2026 23:15
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