diff options
author | Leoi Hung Kin | 2021-09-24 01:27:16 +0000 |
---|---|---|
committer | GitHub | 2021-09-24 01:27:16 +0000 |
commit | 432bec10eddb3f51f3a6e32aedbfd566d74cde75 (patch) | |
tree | 9ac9502d21fb8c84adc28df261d00ccf475a0d47 /helix-term/src | |
parent | 9456d5c1a258e71bbb7e391dec8c3efb819e2d7d (diff) |
allow smart case in global search (#781)
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/commands.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 5005962f..ac93b5d0 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -43,7 +43,7 @@ use std::{ use once_cell::sync::Lazy; use serde::de::{self, Deserialize, Deserializer}; -use grep_regex::RegexMatcher; +use grep_regex::RegexMatcherBuilder; use grep_searcher::{sinks, BinaryDetection, SearcherBuilder}; use ignore::{DirEntry, WalkBuilder, WalkState}; use tokio_stream::wrappers::UnboundedReceiverStream; @@ -1226,6 +1226,7 @@ fn search_selection(cx: &mut Context) { fn global_search(cx: &mut Context) { let (all_matches_sx, all_matches_rx) = tokio::sync::mpsc::unbounded_channel::<(usize, PathBuf)>(); + let smart_case = cx.editor.config.smart_case; let prompt = ui::regex_prompt( cx, "global search:".into(), @@ -1234,7 +1235,11 @@ fn global_search(cx: &mut Context) { if event != PromptEvent::Validate { return; } - if let Ok(matcher) = RegexMatcher::new_line_matcher(regex.as_str()) { + + if let Ok(matcher) = RegexMatcherBuilder::new() + .case_smart(smart_case) + .build(regex.as_str()) + { let searcher = SearcherBuilder::new() .binary_detection(BinaryDetection::quit(b'\x00')) .build(); |