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 linked ranges + multi-cursor (#16707)

Conrad Irwinfb35f155263e
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 1414d3c65b2..e1a72fc3849 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -3016,6 +3016,17 @@ impl Editor {
if start_offset > buffer_snapshot.len() || end_offset > buffer_snapshot.len() {
continue;
}
+ if self.selections.disjoint_anchor_ranges().iter().any(|s| {
+ if s.start.buffer_id != selection.start.buffer_id
+ || s.end.buffer_id != selection.end.buffer_id
+ {
+ return false;
+ }
+ TO::to_offset(&s.start.text_anchor, &buffer_snapshot) <= end_offset
+ && TO::to_offset(&s.end.text_anchor, &buffer_snapshot) >= start_offset
+ }) {
+ continue;
+ }
let start = buffer_snapshot.anchor_after(start_offset);
let end = buffer_snapshot.anchor_after(end_offset);
linked_edits