on master help sign in
allow smart case in global search (#781)
commit432bec10eddb3f51f3a6e32aedbfd566d74cde75 authorLeoi Hung Kin <leoihungkin@outlook.com> dateFri 24 Sep 2021, 09:27 (5 years ago) parent9456d5c
1 file changed+7−2
helix-term/src/commands.rs+7−2
helix-term/src/commands.rs+7−2
@@ -43,7 +43,7 @@ use std::{
4343use once_cell::sync::Lazy;
4444use serde::de::{self, Deserialize, Deserializer};
4545
46−use grep_regex::RegexMatcher;
46+use grep_regex::RegexMatcherBuilder;
4747use grep_searcher::{sinks, BinaryDetection, SearcherBuilder};
4848use ignore::{DirEntry, WalkBuilder, WalkState};
4949use tokio_stream::wrappers::UnboundedReceiverStream;
@@ -1226,6 +1226,7 @@ fn search_selection(cx: &mut Context) {
12261226fn global_search(cx: &mut Context) {
12271227 let (all_matches_sx, all_matches_rx) =
12281228 tokio::sync::mpsc::unbounded_channel::<(usize, PathBuf)>();
1229+ let smart_case = cx.editor.config.smart_case;
12291230 let prompt = ui::regex_prompt(
12301231 cx,
12311232 "global search:".into(),
@@ -1234,7 +1235,11 @@ fn global_search(cx: &mut Context) {
12341235 if event != PromptEvent::Validate {
12351236 return;
12361237 }
1237− if let Ok(matcher) = RegexMatcher::new_line_matcher(regex.as_str()) {
1238+
1239+ if let Ok(matcher) = RegexMatcherBuilder::new()
1240+ .case_smart(smart_case)
1241+ .build(regex.as_str())
1242+ {
12381243 let searcher = SearcherBuilder::new()
12391244 .binary_detection(BinaryDetection::quit(b'\x00'))
12401245 .build();