Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Dismiss tooltips on click
Conrad Irwind782426491a2
diff --git a/crates/gpui2/src/elements/div.rs b/crates/gpui2/src/elements/div.rsindex 31a8827109d..49a91a98215 100644--- a/crates/gpui2/src/elements/div.rs+++ b/crates/gpui2/src/elements/div.rs@@ -960,11 +960,11 @@ wherecx.background_executor().timer(TOOLTIP_DELAY).await;view.update(&mut cx, move |view_state, cx| {active_tooltip.borrow_mut().replace(ActiveTooltip {- waiting: None,tooltip: Some(AnyTooltip {view: tooltip_builder(view_state, cx),cursor_offset: cx.mouse_position(),}),+ _task: None,});cx.notify();})@@ -972,12 +972,17 @@ where}});active_tooltip.borrow_mut().replace(ActiveTooltip {- waiting: Some(task),tooltip: None,+ _task: Some(task),});}});+ let active_tooltip = element_state.active_tooltip.clone();+ cx.on_mouse_event(move |_, _: &MouseDownEvent, _, _| {+ active_tooltip.borrow_mut().take();+ });+if let Some(active_tooltip) = element_state.active_tooltip.borrow().as_ref() {if active_tooltip.tooltip.is_some() {cx.active_tooltip = active_tooltip.tooltip.clone()@@ -1207,9 +1212,8 @@ pub struct InteractiveElementState {}pub struct ActiveTooltip {- #[allow(unused)] // used to drop the task- waiting: Option<Task<()>>,tooltip: Option<AnyTooltip>,+ _task: Option<Task<()>>,}/// Whether or not the element or a group that contains it is clicked by the mouse.