From 6898a31f066298b9f92daeb0d9c759370af39ceb Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 17 Dec 2024 22:17:08 -0700 Subject: [PATCH] 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 --- crates/editor/src/editor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 7c7bb81a19d5248924b269a9843d336a97044d53..8ffac575035a455e36727971b7fd15f9966a99a7 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -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())