@@ -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()
@@ -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(
@@ -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 features