Fix handling of excerpts surrounded by edits in MultiBuffer::edit

This commit is contained in:
Max Brunsfeld 2021-12-15 12:12:39 -08:00
parent 4bea16eb31
commit 2930ea8fb0

View file

@ -352,13 +352,10 @@ impl MultiBuffer {
if excerpt.id == end_excerpt.id { if excerpt.id == end_excerpt.id {
break; break;
} }
let excerpt_range = start_excerpt.range.end.to_offset(&start_excerpt.buffer)
..start_excerpt.range.end.to_offset(&start_excerpt.buffer);
buffer_edits buffer_edits
.entry(excerpt.buffer_id) .entry(excerpt.buffer_id)
.or_insert(Vec::new()) .or_insert(Vec::new())
.push((excerpt_range, false)); .push((excerpt.range.to_offset(&excerpt.buffer), false));
cursor.next(&()); cursor.next(&());
} }
} }
@ -386,7 +383,7 @@ impl MultiBuffer {
insertions.push( insertions.push(
buffer.anchor_before(range.start)..buffer.anchor_before(range.end), buffer.anchor_before(range.start)..buffer.anchor_before(range.end),
); );
} else { } else if !range.is_empty() {
deletions.push( deletions.push(
buffer.anchor_before(range.start)..buffer.anchor_before(range.end), buffer.anchor_before(range.start)..buffer.anchor_before(range.end),
); );