Skip to content

Commit

Permalink
Fix runnable, code_actions button can not trigger when editor not foc…
Browse files Browse the repository at this point in the history
…used (#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.
  • Loading branch information
huacnlee authored May 13, 2024
1 parent 91b9e4e commit 6df1bc8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -4540,12 +4541,13 @@ impl Editor {
row: DisplayRow,
cx: &mut ViewContext<Self>,
) -> 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),
Expand Down

0 comments on commit 6df1bc8

Please sign in to comment.