Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
chat panel: Fix tooltips not working for links (#9691)
Bennet Bo Fennerce57db497ef7
diff --git a/crates/gpui/src/elements/text.rs b/crates/gpui/src/elements/text.rsindex 75452e701e4..735e8dc8584 100644--- a/crates/gpui/src/elements/text.rs+++ b/crates/gpui/src/elements/text.rs@@ -415,8 +415,26 @@ impl Element for InteractiveText {state: &mut Self::BeforeLayout,cx: &mut ElementContext,) -> Hitbox {- self.text.after_layout(bounds, state, cx);- cx.insert_hitbox(bounds, false)+ cx.with_element_state::<InteractiveTextState, _>(+ Some(self.element_id.clone()),+ |interactive_state, cx| {+ let interactive_state = interactive_state+ .map(|interactive_state| interactive_state.unwrap_or_default());++ if let Some(interactive_state) = interactive_state.as_ref() {+ if let Some(active_tooltip) = interactive_state.active_tooltip.borrow().as_ref()+ {+ if let Some(tooltip) = active_tooltip.tooltip.clone() {+ cx.set_tooltip(tooltip);+ }+ }+ }++ self.text.after_layout(bounds, state, cx);+ let hitbox = cx.insert_hitbox(bounds, false);+ (hitbox, interactive_state)+ },+ )}fn paint(@@ -557,16 +575,6 @@ impl Element for InteractiveText {cx.on_mouse_event(move |_: &MouseDownEvent, _, _| {active_tooltip.take();});-- if let Some(tooltip) = interactive_state- .active_tooltip- .clone()- .borrow()- .as_ref()- .and_then(|at| at.tooltip.clone())- {- cx.set_tooltip(tooltip);- }}self.text.paint(bounds, text_state, &mut (), cx);