Skip to content

feat(search): add Alt+C case-insensitive toggle#81

Open
roramirez wants to merge 1 commit into
mainfrom
feat/search-case-insensitive
Open

feat(search): add Alt+C case-insensitive toggle#81
roramirez wants to merge 1 commit into
mainfrom
feat/search-case-insensitive

Conversation

@roramirez

Copy link
Copy Markdown
Owner

Summary

Scrollback search is regex-based and was always case-sensitive. This adds an Alt+C toggle inside Search mode that flips case sensitivity and recomputes matches live. When case-insensitive matching is active, the status bar search info shows a trailing [i] indicator.

Changes

  • src/search.rs: compute_search_matches now takes a case_insensitive: bool and builds the regex via regex::RegexBuilder::new(query).case_insensitive(..).build() (still falls back to empty matches on invalid regex).
  • src/app_state.rs: add search_case_insensitive: bool to AppState (default false), thread it into update_search_matches.
  • src/app_event.rs: handle_search_key detects Alt+C (checking self.modifiers.state().alt_key()) before the copy-current-match interception, flips the flag, and recomputes. Plain c / Ctrl+C still copy the current match.
  • src/renderer/text.rs + render_ops.rs: thread the flag through drawdraw_status_bardraw_search_info, rendering the [i] indicator.
  • Tests: search_test.rs (case-sensitive vs case-insensitive match counts), app_state_test.rs (toggling the flag and recomputing changes the match count); existing renderer/scenario call sites updated for the new parameter.
  • Docs: CHANGELOG.md, doc/SPEC.md, README.md.

How to test

  • cargo test — new tests case_sensitive_misses_differing_case, case_insensitive_matches_all_cases, toggling_case_insensitive_changes_match_count pass; full suite green.
  • Manually: enter Search mode with /, type a lowercase query that appears in mixed case, press Alt+C — match count increases and [i] appears in the status bar; press Alt+C again to revert. Confirm plain c still copies the current match.

Scrollback search was regex-based and always case-sensitive. Alt+C in
Search mode now flips a per-session case-insensitivity flag, recomputes
matches live via RegexBuilder::case_insensitive, and the status bar shows
[i] while active. Plain c still copies the current match.
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