Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix multibuffer to not mark everything as edited when buffer diffs don't change (#48424)

Conrad Irwincfb4cefb3716
diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs
index 41a253d97d7..842dd78a1a9 100644
--- a/crates/multi_buffer/src/multi_buffer.rs
+++ b/crates/multi_buffer/src/multi_buffer.rs
@@ -2609,6 +2609,13 @@ impl MultiBuffer {
pub fn add_diff(&mut self, diff: Entity<BufferDiff>, cx: &mut Context<Self>) {
let buffer_id = diff.read(cx).buffer_id;
+
+ if let Some(existing_diff) = self.diff_for(buffer_id)
+ && diff.entity_id() == existing_diff.entity_id()
+ {
+ return;
+ }
+
self.buffer_diff_changed(
diff.clone(),
text::Anchor::min_max_range_for_buffer(buffer_id),