From 52ea501f4f4488ec8fb9cbc5e6203b69c1ce5b9e Mon Sep 17 00:00:00 2001 From: neunato Date: Tue, 6 May 2025 08:45:43 +0200 Subject: [PATCH] Fix multicursors not being added when clicking on line numbers (#28263) Closes https://github.com/zed-industries/zed/issues/21372 Release Notes: - Fixed multicursors not being added when clicking on line numbers ----- I tracked this down to https://github.com/zed-industries/zed/blob/b6ee367ee0e62a111164dd6e09c534e7e48bad5a/crates/editor/src/element.rs#L591 being forwarded to `editor.select()` a few lines below https://github.com/zed-industries/zed/blob/b6ee367ee0e62a111164dd6e09c534e7e48bad5a/crates/editor/src/element.rs#L667-L675 resulting in `add == true` and `click_count == 3`, triggering this https://github.com/zed-industries/zed/blob/b6ee367ee0e62a111164dd6e09c534e7e48bad5a/crates/editor/src/editor.rs#L2750-L2752 ... and we end up removing the previous selection. This was added [in 2021](https://github.com/zed-industries/zed/commit/bfecdb7bc0e51ed1e37c8d0f61ceb27c5c6b5de9) under this reasoning: > This prevents selections added in earlier clicks from being rendered under the pending selection. which no longer seems to be an issue, so removing should be safe? --------- Co-authored-by: Peter Tripp --- crates/editor/src/editor.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index d722f71d8bbd8ca2cf18cea05cd531ad5605ca27..4e3ace4949476baebf96bad6e375e53960917286 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -2972,7 +2972,6 @@ impl Editor { let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); let buffer = &display_map.buffer_snapshot; - let newest_selection = self.selections.newest_anchor().clone(); let position = display_map.clip_point(position, Bias::Left); let start; @@ -3047,8 +3046,6 @@ impl Editor { } else { if !add { s.clear_disjoint(); - } else if click_count > 1 { - s.delete(newest_selection.id) } s.set_pending_anchor_range(start..end, mode);