From f3abb7e7246ab5d7e6644da7314a511d80fbb7d5 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:18:31 +0200 Subject: [PATCH] assistant: Grab focus when clicking on history icon --- crates/assistant/src/assistant_panel.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index e991406c57..6d1c1ed261 100644 --- a/crates/assistant/src/assistant_panel.rs +++ b/crates/assistant/src/assistant_panel.rs @@ -363,9 +363,13 @@ impl AssistantPanel { pane.set_render_tab_bar_buttons(cx, move |pane, cx| { let focus_handle = pane.focus_handle(cx); let left_children = IconButton::new("history", IconName::TextSearch) - .on_click( - cx.listener(|_, _, cx| cx.dispatch_action(DeployHistory.boxed_clone())), - ) + .on_click(cx.listener({ + let focus_handle = focus_handle.clone(); + move |_, _, cx| { + focus_handle.focus(cx); + cx.dispatch_action(DeployHistory.boxed_clone()) + } + })) .tooltip(move |cx| { cx.new_view(|cx| { let keybind =