Skip to content

Commit

Permalink
chore(git): when searching with f: syntax, use smart case sensitivity (
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys authored Aug 1, 2024
1 parent 05c7866 commit 48f9e08
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crates/tabby-git/src/grep/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,16 @@ impl GrepQuery {
let file_pattern_matcher = if self.file_patterns.is_empty() {
vec![]
} else {
let mut matcher = vec![];
let mut matchers = vec![];
for p in &self.file_patterns {
matcher.push(RegexMatcher::new_line_matcher(p)?);
let case_insensitive = !has_uppercase_literal(p);
let matcher = RegexMatcherBuilder::new()
.case_insensitive(case_insensitive)
.line_terminator(Some(b'\n'))
.build(p)?;
matchers.push(matcher);
}
matcher
matchers
};

let negative_file_pattern_matcher = if self.negative_file_patterns.is_empty() {
Expand Down

0 comments on commit 48f9e08

Please sign in to comment.