Skip to content

Commit

Permalink
Fix panic when opening proposed changes editor with reversed ranges (z…
Browse files Browse the repository at this point in the history
…ed-industries#18599)

Closes zed-industries#18589

Release Notes:

- N/A

Co-authored-by: Antonio <antonio@zed.dev>
  • Loading branch information
maxbrunsfeld and as-cii authored Oct 1, 2024
1 parent 7dcb0de commit 563a1dc
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 563a1dc

Please sign in to comment.