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 panic in linked editing ranges (#21905)

Conrad Irwin6898a31f0662
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 7c7bb81a19d..8ffac575035 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -5432,7 +5432,8 @@ impl Editor {
if end_point == start_point {
let offset = text::ToOffset::to_offset(&range.start, &snapshot)
.saturating_sub(1);
- start_point = TP::to_point(&offset, &snapshot);
+ start_point =
+ snapshot.clip_point(TP::to_point(&offset, &snapshot), Bias::Left);
};
(start_point..end_point, empty_str.clone())