Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Always focus a panel when zooming it
Nathan Sobo1707652643a5
diff --git a/crates/ai/src/assistant.rs b/crates/ai/src/assistant.rsindex c8e3dce862d..5426715bf00 100644--- a/crates/ai/src/assistant.rs+++ b/crates/ai/src/assistant.rs@@ -384,13 +384,7 @@ impl AssistantPanel {}).with_cursor_style(CursorStyle::PointingHand).on_click(MouseButton::Left, |_, this, cx| {- if this.zoomed {- cx.emit(AssistantPanelEvent::ZoomOut)- } else {- this.has_focus = true; // Hack: Because focus_in is processed last, we need to set this here.- cx.focus_self();- cx.emit(AssistantPanelEvent::ZoomIn);- }+ this.toggle_zoom(&ToggleZoom, cx);})}diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex d93dae2d13b..6fcb12e77c1 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -905,10 +905,11 @@ impl Workspace {});} else if T::should_zoom_in_on_event(event) {dock.update(cx, |dock, cx| dock.set_panel_zoomed(&panel, true, cx));- if panel.has_focus(cx) {- this.zoomed = Some(panel.downgrade().into_any());- this.zoomed_position = Some(panel.read(cx).position(cx));+ if !panel.has_focus(cx) {+ cx.focus(&panel);}+ this.zoomed = Some(panel.downgrade().into_any());+ this.zoomed_position = Some(panel.read(cx).position(cx));} else if T::should_zoom_out_on_event(event) {dock.update(cx, |dock, cx| dock.set_panel_zoomed(&panel, false, cx));if this.zoomed_position == Some(prev_position) {