From bcf7bc9de8e57c4ea1bb0cfe8442133c726fd5de Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 7 May 2024 17:06:12 +0300 Subject: [PATCH] Do not toggle hunk diffs when resizing the docks (#11489) Closes https://github.com/zed-industries/zed/issues/11456 Release Notes: - N/A --------- Co-authored-by: Piotr --- crates/workspace/src/dock.rs | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index 0f281952fba731b180b511a84198a54d651b48f8..a304ef4a6392514b90ea4c26ae06aebb37834150 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -2,10 +2,10 @@ use crate::persistence::model::DockData; use crate::{status_bar::StatusItemView, Workspace}; use crate::{DraggedDock, Event}; use gpui::{ - deferred, div, px, Action, AnchorCorner, AnyView, AppContext, Axis, ClickEvent, Entity, - EntityId, EventEmitter, FocusHandle, FocusableView, IntoElement, KeyContext, MouseButton, - ParentElement, Render, SharedString, StyleRefinement, Styled, Subscription, View, ViewContext, - VisualContext, WeakView, WindowContext, + deferred, div, px, Action, AnchorCorner, AnyView, AppContext, Axis, Entity, EntityId, + EventEmitter, FocusHandle, FocusableView, IntoElement, KeyContext, MouseButton, MouseDownEvent, + MouseUpEvent, ParentElement, Render, SharedString, StyleRefinement, Styled, Subscription, View, + ViewContext, VisualContext, WeakView, WindowContext, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -573,12 +573,21 @@ impl Render for Dock { cx.stop_propagation(); cx.new_view(|_| dock.clone()) }) - .on_click(cx.listener(|v, e: &ClickEvent, cx| { - if e.down.button == MouseButton::Left && e.down.click_count == 2 { - v.resize_active_panel(None, cx); + .on_mouse_down( + MouseButton::Left, + cx.listener(|_, _: &MouseDownEvent, cx| { cx.stop_propagation(); - } - })) + }), + ) + .on_mouse_up( + MouseButton::Left, + cx.listener(|v, e: &MouseUpEvent, cx| { + if e.click_count == 2 { + v.resize_active_panel(None, cx); + cx.stop_propagation(); + } + }), + ) .occlude(); match self.position() { DockPosition::Left => deferred(