aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorkraem2021-09-20 04:45:07 +0000
committerGitHub2021-09-20 04:45:07 +0000
commit4a003782a51a94259ef3b5ddfacb2a148c5056e7 (patch)
tree1a512225ca556532ea55e2d16f98f18b71130948 /helix-term/src/ui
parente0e41f4f775db1210b5a8d5d224ac74c7756471c (diff)
enable smart case regex search by default (#761)
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/mod.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index 07eef352..f6536eb2 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -20,6 +20,7 @@ pub use spinner::{ProgressSpinners, Spinner};
pub use text::Text;
use helix_core::regex::Regex;
+use helix_core::regex::RegexBuilder;
use helix_view::{Document, Editor, View};
use std::path::PathBuf;
@@ -53,7 +54,16 @@ pub fn regex_prompt(
return;
}
- match Regex::new(input) {
+ let case_insensitive = if cx.editor.config.smart_case {
+ !input.chars().any(char::is_uppercase)
+ } else {
+ false
+ };
+
+ match RegexBuilder::new(input)
+ .case_insensitive(case_insensitive)
+ .build()
+ {
Ok(regex) => {
let (view, doc) = current!(cx.editor);