mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-01 20:52:03 -07:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3bb387abdd | ||
|
7f0273c347 |
@@ -214,7 +214,7 @@ impl Pattern {
|
||||
/// regular expression and will represent the matching semantics of this
|
||||
/// glob pattern and the options given.
|
||||
pub fn to_regex_with(&self, options: &MatchOptions) -> String {
|
||||
let sep = path::MAIN_SEPARATOR.to_string();
|
||||
let sep = regex::quote(&path::MAIN_SEPARATOR.to_string());
|
||||
let mut re = String::new();
|
||||
re.push_str("(?-u)");
|
||||
if options.case_insensitive {
|
||||
@@ -235,14 +235,14 @@ impl Pattern {
|
||||
}
|
||||
Token::Any => {
|
||||
if options.require_literal_separator {
|
||||
re.push_str(&format!("[^{}]", regex::quote(&sep)));
|
||||
re.push_str(&format!("[^{}]", sep));
|
||||
} else {
|
||||
re.push_str(".");
|
||||
}
|
||||
}
|
||||
Token::ZeroOrMore => {
|
||||
if options.require_literal_separator {
|
||||
re.push_str(&format!("[^{}]*", regex::quote(&sep)));
|
||||
re.push_str(&format!("[^{}]*", sep));
|
||||
} else {
|
||||
re.push_str(".*");
|
||||
}
|
||||
|
@@ -239,6 +239,7 @@ impl<W: Send + io::Write> Printer<W> {
|
||||
fn line_number(&mut self, n: u64, sep: u8) {
|
||||
if self.wtr.is_color() {
|
||||
let _ = self.wtr.fg(YELLOW);
|
||||
let _ = self.wtr.attr(term::Attr::Bold);
|
||||
}
|
||||
self.write(n.to_string().as_bytes());
|
||||
if self.wtr.is_color() {
|
||||
|
Reference in New Issue
Block a user