mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 20:22:30 +00:00
Don't emit duplicate text when mixing syntax highlighting and match indices
This commit is contained in:
parent
ecba761e18
commit
b0033bb6d4
1 changed files with 5 additions and 5 deletions
|
@ -437,7 +437,7 @@ fn combine_syntax_and_fuzzy_match_highlights(
|
|||
|
||||
let mut end_index = char_ix_after(match_index, text);
|
||||
while let Some(&next_match_index) = match_indices.peek() {
|
||||
if next_match_index == end_index {
|
||||
if next_match_index == end_index && next_match_index < range.end {
|
||||
end_index = char_ix_after(next_match_index, text);
|
||||
match_indices.next();
|
||||
} else {
|
||||
|
@ -485,14 +485,14 @@ mod tests {
|
|||
},
|
||||
),
|
||||
(
|
||||
4..10,
|
||||
4..8,
|
||||
HighlightStyle {
|
||||
color: Color::green(),
|
||||
..default
|
||||
},
|
||||
),
|
||||
];
|
||||
let match_indices = [4, 6, 7];
|
||||
let match_indices = [4, 6, 7, 8];
|
||||
let match_underline = Color::white();
|
||||
assert_eq!(
|
||||
combine_syntax_and_fuzzy_match_highlights(
|
||||
|
@ -534,9 +534,9 @@ mod tests {
|
|||
},
|
||||
),
|
||||
(
|
||||
8..10,
|
||||
8..9,
|
||||
HighlightStyle {
|
||||
color: Color::green(),
|
||||
underline: Some(match_underline),
|
||||
..default
|
||||
},
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue