fixed highlighting for double globs like 'dir/**/*.rs'

This commit is contained in:
2026-02-19 21:43:49 -05:00
parent a18a0b622f
commit 886d348d53

View File

@@ -942,11 +942,20 @@ pub fn annotate_token(token: Tk) -> Vec<(usize, Marker)> {
} }
} }
'*' | '?' if (!in_dub_qt && !in_sng_qt) => { '*' | '?' if (!in_dub_qt && !in_sng_qt) => {
let glob_ch = *ch;
token_chars.next(); // consume the first glob char
if !in_context(markers::COMMAND, &insertions) { if !in_context(markers::COMMAND, &insertions) {
insertions.push((span_start + *i + 1, markers::RESET)); let offset = if glob_ch == '*' && token_chars.peek().is_some_and(|(_, c)| *c == '*') {
insertions.push((span_start + *i, markers::GLOB)); // it's one of these probably: ./dir/**/*.txt
token_chars.next(); // consume the second *
2
} else {
// just a regular glob char
1
};
insertions.push((span_start + index + offset, markers::RESET));
insertions.push((span_start + index, markers::GLOB));
} }
token_chars.next(); // consume the glob char
} }
_ => { _ => {
token_chars.next(); // consume the char with no special handling token_chars.next(); // consume the char with no special handling