From 4b9dac8fb82141cc900c992398ab96db3d94fd03 Mon Sep 17 00:00:00 2001 From: Xuz Date: Thu, 24 Sep 2026 19:05:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BC=9A=E8=AF=9D=E6=A0=91?= =?UTF-8?q?=E5=8F=B3=E9=94=AE=E5=90=8E=E9=80=89=E4=B8=AD=E9=AB=98=E4=BA=AE?= =?UTF-8?q?=E6=AE=8B=E7=95=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/session/session_panel.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/session/session_panel.rs b/src/session/session_panel.rs index b5d571a..c99600b 100644 --- a/src/session/session_panel.rs +++ b/src/session/session_panel.rs @@ -444,9 +444,14 @@ impl Render for SessionPanel { .child( BaseTree::new(&self.tree_state) .item(move |_, entry, state, _, cx| { + let node = SessionNode::parse(&entry.item().id); + let selected = match row_interactions.right_clicked.get() { + Some(right_clicked) => node == Some(right_clicked), + None => state.is_selected(), + }; render_row( entry, - state.is_selected() || state.is_right_clicked(), + selected, &group_counts, &host_os, &row_interactions, @@ -468,11 +473,11 @@ impl Render for SessionPanel { // being prepainted, and the focus it takes there lands in // the middle of the frame, which trips gpui's "set_focus // called more than once in a single frame" assertion. - // Capture runs before every bubble handler, so this clears - // the target and the row that was hit writes itself back; - // a click on blank space leaves it cleared. + // Capture runs before every bubble handler. Clear the + // context selection on any new click; a right-clicked row + // writes itself back before the menu is built. .capture_any_mouse_down(move |event, _, _| { - if event.button == MouseButton::Right { + if matches!(event.button, MouseButton::Left | MouseButton::Right) { clicked_blank.set(None); } })