highlighter: Fix some case update will get incorrect syntax highlight. (#1041)
This commit is contained in:
parent
1069469c46
commit
1a4b7ce76a
1 changed files with 9 additions and 5 deletions
|
|
@ -272,15 +272,19 @@ impl SyntaxHighlighter {
|
||||||
|
|
||||||
// Incremental parsing to only update changed ranges.
|
// Incremental parsing to only update changed ranges.
|
||||||
if let Some(changed_ranges) = changed_ranges {
|
if let Some(changed_ranges) = changed_ranges {
|
||||||
let mut total_range = 0..0;
|
let mut total_range = (None, None);
|
||||||
for change_range in changed_ranges {
|
for change_range in changed_ranges {
|
||||||
if total_range.start == 0 {
|
// dbg!(change_range);
|
||||||
total_range.start = change_range.start_byte;
|
if total_range.0.is_none() {
|
||||||
|
total_range.0 = Some(change_range.start_byte);
|
||||||
}
|
}
|
||||||
if total_range.end == 0 {
|
if total_range.1.is_none() {
|
||||||
total_range.end = change_range.end_byte;
|
total_range.1 = Some(change_range.end_byte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let total_range = total_range.0.unwrap_or(0)..total_range.1.unwrap_or(0);
|
||||||
|
|
||||||
|
// println!("------- total_range: {:?}", total_range);
|
||||||
|
|
||||||
if total_range.len() == 0 {
|
if total_range.len() == 0 {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue