Fix panic when opening proposed changes editor with reversed ranges (#18599)

Closes https://github.com/zed-industries/zed/issues/18589

Release Notes:

- N/A

Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
Max Brunsfeld
2024-10-01 12:58:21 -06:00
committed by GitHub
co-authored by Antonio
parent 7dcb0de28c
commit 563a1dcbab
+1 -4
View File
@@ -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);