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.

Clear selections on buffer only if they hadn't been cleared already

Antonio Scandurraa435dc1339bd
diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs
index acccb553d3d..09a96342271 100644
--- a/crates/language/src/buffer.rs
+++ b/crates/language/src/buffer.rs
@@ -1353,7 +1353,13 @@ impl Buffer {
}
pub fn remove_active_selections(&mut self, cx: &mut ModelContext<Self>) {
- self.set_active_selections(Arc::from([]), false, Default::default(), cx);
+ if self
+ .remote_selections
+ .get(&self.text.replica_id())
+ .map_or(true, |set| !set.selections.is_empty())
+ {
+ self.set_active_selections(Arc::from([]), false, Default::default(), cx);
+ }
}
pub fn set_text<T>(&mut self, text: T, cx: &mut ModelContext<Self>) -> Option<clock::Local>