Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Avoid creating occlusions for editor blocks, since these block mouse wheel events (#20649)
Max Brunsfeld093c9cc87b05
diff --git a/crates/assistant/src/inline_assistant.rs b/crates/assistant/src/inline_assistant.rsindex 1d1a6f55205..22620ca2c2e 100644--- a/crates/assistant/src/inline_assistant.rs+++ b/crates/assistant/src/inline_assistant.rs@@ -24,9 +24,9 @@ use futures::{join, SinkExt, Stream, StreamExt,};use gpui::{- anchored, deferred, point, AnyElement, AppContext, ClickEvent, EventEmitter, FocusHandle,- FocusableView, FontWeight, Global, HighlightStyle, Model, ModelContext, Subscription, Task,- TextStyle, UpdateGlobal, View, ViewContext, WeakView, WindowContext,+ anchored, deferred, point, AnyElement, AppContext, ClickEvent, CursorStyle, EventEmitter,+ FocusHandle, FocusableView, FontWeight, Global, HighlightStyle, Model, ModelContext,+ Subscription, Task, TextStyle, UpdateGlobal, View, ViewContext, WeakView, WindowContext,};use language::{Buffer, IndentKind, Point, Selection, TransactionId};use language_model::{@@ -1199,7 +1199,7 @@ impl InlineAssistant {style: BlockStyle::Flex,render: Arc::new(move |cx| {div()- .occlude()+ .block_mouse_down().bg(cx.theme().status().deleted_background).size_full().h(height as f32 * cx.line_height())@@ -1481,7 +1481,8 @@ impl Render for PromptEditor {h_flex().key_context("PromptEditor").bg(cx.theme().colors().editor_background)- .occlude()+ .block_mouse_down()+ .cursor(CursorStyle::Arrow).border_y_1().border_color(cx.theme().status().info_border).size_full()diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rsindex 7ebf706ab17..933bed27112 100644--- a/crates/diagnostics/src/diagnostics.rs+++ b/crates/diagnostics/src/diagnostics.rs@@ -795,7 +795,7 @@ fn diagnostic_header_renderer(diagnostic: Diagnostic) -> RenderBlock {let highlight_style: HighlightStyle = cx.theme().colors().text_accent.into();h_flex().id(DIAGNOSTIC_HEADER)- .occlude()+ .block_mouse_down().h(2. * cx.line_height()).pl_10().pr_5()diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex eb822ee288a..9d8044f075e 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -10431,7 +10431,7 @@ impl Editor {text_style = text_style.highlight(highlight_style);}div()- .occlude()+ .block_mouse_down().pl(cx.anchor_x).child(EditorElement::new(&rename_editor,@@ -14681,7 +14681,7 @@ pub fn diagnostic_block_renderer(.group(group_id.clone()).relative().size_full()- .occlude()+ .block_mouse_down().pl(cx.gutter_dimensions.width).w(cx.max_width - cx.gutter_dimensions.full_width()).child(diff --git a/crates/editor/src/hunk_diff.rs b/crates/editor/src/hunk_diff.rsindex b81ccb8fa26..27bb8ac5574 100644--- a/crates/editor/src/hunk_diff.rs+++ b/crates/editor/src/hunk_diff.rs@@ -435,7 +435,7 @@ impl Editor {h_flex().id(cx.block_id)- .occlude()+ .block_mouse_down().h(cx.line_height()).w_full().border_t_1()@@ -714,7 +714,7 @@ impl Editor {h_flex().id(cx.block_id)- .occlude()+ .block_mouse_down().bg(deleted_hunk_color).h(height as f32 * cx.line_height()).w_full()diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rsindex e2015197e0f..840dbd5dc43 100644--- a/crates/gpui/src/elements/div.rs+++ b/crates/gpui/src/elements/div.rs@@ -511,7 +511,7 @@ impl Interactivity {}/// Block the mouse from interacting with this element or any of its children- /// The imperative API equivalent to [`InteractiveElement::block_mouse`]+ /// The imperative API equivalent to [`InteractiveElement::occlude`]pub fn occlude_mouse(&mut self) {self.occlude_mouse = true;}@@ -874,11 +874,17 @@ pub trait InteractiveElement: Sized {}/// Block the mouse from interacting with this element or any of its children- /// The fluent API equivalent to [`Interactivity::block_mouse`]+ /// The fluent API equivalent to [`Interactivity::occlude_mouse`]fn occlude(mut self) -> Self {self.interactivity().occlude_mouse();self}++ /// Block the mouse from interacting with this element or any of its children+ /// The fluent API equivalent to [`Interactivity::occlude_mouse`]+ fn block_mouse_down(mut self) -> Self {+ self.on_mouse_down(MouseButton::Left, |_, cx| cx.stop_propagation())+ }}/// A trait for elements that want to use the standard GPUI interactivity featuresdiff --git a/crates/repl/src/session.rs b/crates/repl/src/session.rsindex 2f67ce63be9..74ce4975725 100644--- a/crates/repl/src/session.rs+++ b/crates/repl/src/session.rs@@ -163,7 +163,7 @@ impl EditorBlock {div().id(cx.block_id)- .occlude()+ .block_mouse_down().flex().items_start().min_h(text_line_height)