From 2ce01ead93f9d7b5f307ae0c016cd9495084e28c Mon Sep 17 00:00:00 2001 From: tims <0xtimsb@gmail.com> Date: Mon, 9 Dec 2024 07:43:12 +0530 Subject: [PATCH] Fix right click selection behavior in project panel (#21707) Closes #21605 Consider you have set of entries selected or even a single entry selected, and you right click some other entry which is **not** part of your selected set. This doesn't not clear existing entries selection (which it should clear, as how file manager right-click logic works, see more below). This issue might lead unexpected operation like deletion applied on those existing selected entries. This PR fixes it. Release Notes: - Fix right click selection behavior in project panel --- crates/project_panel/src/project_panel.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 12c90e2195..7433d0599f 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -3496,6 +3496,9 @@ impl ProjectPanel { // Stop propagation to prevent the catch-all context menu for the project // panel from being deployed. cx.stop_propagation(); + if !this.marked_entries.contains(&selection) { + this.marked_entries.clear(); + } this.deploy_context_menu(event.position, entry_id, cx); }, ))