mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-28 01:24:17 +00:00
minimize diff
This commit is contained in:
parent
0aa7375967
commit
f04b252dd9
1 changed files with 5 additions and 13 deletions
|
|
@ -777,23 +777,15 @@ impl SyntaxSnapshot {
|
|||
changed_ranges.is_empty(),
|
||||
) {
|
||||
for range in &changed_ranges {
|
||||
let start_point = range.start.to_point(text);
|
||||
let end_point = range.end.to_point(text);
|
||||
|
||||
let expanded_start_row = start_point.row.saturating_sub(1);
|
||||
let expanded_end_row = end_point.row + 2;
|
||||
|
||||
let expanded_start =
|
||||
text.point_to_offset(Point::new(expanded_start_row, 0));
|
||||
let expanded_end = text
|
||||
.point_to_offset(Point::new(expanded_end_row, 0))
|
||||
.min(text.len());
|
||||
let start_row = range.start.to_point(text).row.saturating_sub(1);
|
||||
let end_row = range.end.to_point(text).row.saturating_add(2);
|
||||
let start = text.point_to_offset(Point::new(start_row, 0));
|
||||
let end = text.point_to_offset(Point::new(end_row, 0)).min(text.len());
|
||||
|
||||
changed_regions.insert(
|
||||
ChangedRegion {
|
||||
depth: step.depth + 1,
|
||||
range: text.anchor_before(expanded_start)
|
||||
..text.anchor_after(expanded_end),
|
||||
range: text.anchor_before(start)..text.anchor_after(end),
|
||||
},
|
||||
text,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue