Skip to content

Commit

Permalink
Fix panic in linked editing ranges (zed-industries#21905)
Browse files Browse the repository at this point in the history
We were committing the cardinal sin of subtracting one from a column
without clipping

Closes #ISSUE

Release Notes:

- Fixed a panic in linked editing ranges
  • Loading branch information
ConradIrwin authored and helgemahrt committed Dec 18, 2024
1 parent 1ab74ad commit 2783342
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 2783342

Please sign in to comment.