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 <piotr@zed.dev>
This commit is contained in:
Kirill Bulatov 2024-05-07 17:06:12 +03:00 committed by GitHub
parent 5a7b8f7fe3
commit bcf7bc9de8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,10 +2,10 @@ use crate::persistence::model::DockData;
use crate::{status_bar::StatusItemView, Workspace}; use crate::{status_bar::StatusItemView, Workspace};
use crate::{DraggedDock, Event}; use crate::{DraggedDock, Event};
use gpui::{ use gpui::{
deferred, div, px, Action, AnchorCorner, AnyView, AppContext, Axis, ClickEvent, Entity, deferred, div, px, Action, AnchorCorner, AnyView, AppContext, Axis, Entity, EntityId,
EntityId, EventEmitter, FocusHandle, FocusableView, IntoElement, KeyContext, MouseButton, EventEmitter, FocusHandle, FocusableView, IntoElement, KeyContext, MouseButton, MouseDownEvent,
ParentElement, Render, SharedString, StyleRefinement, Styled, Subscription, View, ViewContext, MouseUpEvent, ParentElement, Render, SharedString, StyleRefinement, Styled, Subscription, View,
VisualContext, WeakView, WindowContext, ViewContext, VisualContext, WeakView, WindowContext,
}; };
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -573,12 +573,21 @@ impl Render for Dock {
cx.stop_propagation(); cx.stop_propagation();
cx.new_view(|_| dock.clone()) cx.new_view(|_| dock.clone())
}) })
.on_click(cx.listener(|v, e: &ClickEvent, cx| { .on_mouse_down(
if e.down.button == MouseButton::Left && e.down.click_count == 2 { 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); v.resize_active_panel(None, cx);
cx.stop_propagation(); cx.stop_propagation();
} }
})) }),
)
.occlude(); .occlude();
match self.position() { match self.position() {
DockPosition::Left => deferred( DockPosition::Left => deferred(