From 6df1bc85aa44f7da6dd105f302fd14ac70f2f7d2 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 13 May 2024 17:02:15 +0800 Subject: [PATCH] Fix runnable, code_actions button can not trigger when editor not focused (#11729) ## Before https://github.com/zed-industries/zed/assets/5518/546450fc-ad2c-45d0-8bdb-7b15cfebe235 ## After https://github.com/zed-industries/zed/assets/5518/efc4f863-9db1-4846-83ae-c99ae4dcb3ed Release Notes: - Fixed code actions/runnable buttons not triggering when editor is not focused. --- crates/editor/src/editor.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 1b28a229eed9d760a0b9b91b25b8e4a054e38f02..a08e26520c454569421d9e26a00cbd65e5f54830 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -4509,6 +4509,7 @@ impl Editor { .icon_color(Color::Muted) .selected(is_active) .on_click(cx.listener(move |editor, _e, cx| { + editor.focus(cx); editor.toggle_code_actions( &ToggleCodeActions { deployed_from_indicator: Some(row), @@ -4540,12 +4541,13 @@ impl Editor { row: DisplayRow, cx: &mut ViewContext, ) -> IconButton { - IconButton::new("code_actions_indicator", ui::IconName::Play) + IconButton::new("run_indicator", ui::IconName::Play) .icon_size(IconSize::XSmall) .size(ui::ButtonSize::None) .icon_color(Color::Muted) .selected(is_active) .on_click(cx.listener(move |editor, _e, cx| { + editor.focus(cx); editor.toggle_code_actions( &ToggleCodeActions { deployed_from_indicator: Some(row),