Always sync before clearing or removing excerpts from MultiBuffer

We don't have any test that proves this is needed but seems good nonetheless.
This commit is contained in:
Antonio Scandurra 2022-02-25 15:36:43 +01:00
parent ff0fa0e0bd
commit 2611b5449f

View file

@ -772,6 +772,7 @@ impl MultiBuffer {
}
pub fn clear(&mut self, cx: &mut ModelContext<Self>) {
self.sync(cx);
self.buffers.borrow_mut().clear();
let mut snapshot = self.snapshot.borrow_mut();
let prev_len = snapshot.len();
@ -853,6 +854,7 @@ impl MultiBuffer {
excerpt_ids: impl IntoIterator<Item = &'a ExcerptId>,
cx: &mut ModelContext<Self>,
) {
self.sync(cx);
let mut buffers = self.buffers.borrow_mut();
let mut snapshot = self.snapshot.borrow_mut();
let mut new_excerpts = SumTree::new();