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 when opening proposed changes editor with reversed ranges (#18599)

Max Brunsfeld563a1dcbab67
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 54a1318bdfe..ddc7de4e41a 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -12257,12 +12257,9 @@ impl Editor {
let buffer = self.buffer.read(cx);
let mut new_selections_by_buffer = HashMap::default();
for selection in self.selections.all::<usize>(cx) {
- for (buffer, mut range, _) in
+ for (buffer, range, _) in
buffer.range_to_buffer_ranges(selection.start..selection.end, cx)
{
- if selection.reversed {
- mem::swap(&mut range.start, &mut range.end);
- }
let mut range = range.to_point(buffer.read(cx));
range.start.column = 0;
range.end.column = buffer.read(cx).line_len(range.end.row);