Clear path-based excerpt data properly (#28026)

Follow-up of https://github.com/zed-industries/zed/pull/27893

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Kirill Bulatov
2025-04-03 15:17:10 +00:00
committed by GitHub
co-authored by Conrad Irwin
parent e5e3e9ac8c
commit c674e8d62d
+4 -3
View File
@@ -1719,9 +1719,7 @@ impl MultiBuffer {
(None, Some(_)) => {
let existing_id = existing_iter.next().unwrap();
let locator = snapshot.excerpt_locator_for_id(existing_id);
let Some(existing_excerpt) = excerpts_cursor.item() else {
break;
};
let existing_excerpt = excerpts_cursor.item().unwrap();
excerpts_cursor.seek_forward(&Some(locator), Bias::Left, &());
let existing_end = existing_excerpt
.range
@@ -1993,6 +1991,8 @@ impl MultiBuffer {
self.sync(cx);
let ids = self.excerpt_ids();
self.buffers.borrow_mut().clear();
self.excerpts_by_path.clear();
self.paths_by_excerpt.clear();
let mut snapshot = self.snapshot.borrow_mut();
let start = ExcerptOffset::new(0);
let prev_len = ExcerptOffset::new(snapshot.excerpts.summary().text.len);
@@ -2001,6 +2001,7 @@ impl MultiBuffer {
snapshot.is_dirty = false;
snapshot.has_deleted_file = false;
snapshot.has_conflict = false;
snapshot.replaced_excerpts.clear();
self.sync_diff_transforms(
&mut snapshot,