mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 19:10:24 +00:00
Fix collection of row ranges in Buffer::perform_autoindent
This commit is contained in:
parent
2f295382c4
commit
b5d3ffb16c
1 changed files with 16 additions and 19 deletions
|
@ -1022,31 +1022,28 @@ impl Buffer {
|
|||
}
|
||||
self.autoindent_requests = autoindent_requests;
|
||||
|
||||
let mut row_range = None;
|
||||
let mut row_range: Option<Range<u32>> = None;
|
||||
let mut cursor1 = QueryCursorHandle::new();
|
||||
let mut cursor2 = QueryCursorHandle::new();
|
||||
self.start_transaction(None).unwrap();
|
||||
for row in autoindent_requests_by_row.keys().copied() {
|
||||
match &mut row_range {
|
||||
None => row_range = Some(row..(row + 1)),
|
||||
Some(range) => {
|
||||
if range.end == row {
|
||||
range.end += 1;
|
||||
} else {
|
||||
self.perform_autoindent_for_rows(
|
||||
range.clone(),
|
||||
old_tree.as_ref(),
|
||||
&new_tree,
|
||||
&autoindent_requests_by_row,
|
||||
language.as_ref(),
|
||||
&mut cursor1,
|
||||
&mut cursor2,
|
||||
cx,
|
||||
);
|
||||
row_range.take();
|
||||
}
|
||||
if let Some(range) = &mut row_range {
|
||||
if range.end == row {
|
||||
range.end += 1;
|
||||
continue;
|
||||
}
|
||||
self.perform_autoindent_for_rows(
|
||||
range.clone(),
|
||||
old_tree.as_ref(),
|
||||
&new_tree,
|
||||
&autoindent_requests_by_row,
|
||||
language.as_ref(),
|
||||
&mut cursor1,
|
||||
&mut cursor2,
|
||||
cx,
|
||||
);
|
||||
}
|
||||
row_range = Some(row..(row + 1));
|
||||
}
|
||||
if let Some(range) = row_range {
|
||||
self.perform_autoindent_for_rows(
|
||||
|
|
Loading…
Reference in a new issue