Fix panic in linked editing ranges (#21905)

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
This commit is contained in:
Conrad Irwin 2024-12-17 22:17:08 -07:00 committed by GitHub
parent 94bfb93d35
commit 6898a31f06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5432,7 +5432,8 @@ impl Editor {
if end_point == start_point { if end_point == start_point {
let offset = text::ToOffset::to_offset(&range.start, &snapshot) let offset = text::ToOffset::to_offset(&range.start, &snapshot)
.saturating_sub(1); .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()) (start_point..end_point, empty_str.clone())