diff --git a/crates/ui/src/text/inline.rs b/crates/ui/src/text/inline.rs index 37e8f5c07..686dc2e58 100644 --- a/crates/ui/src/text/inline.rs +++ b/crates/ui/src/text/inline.rs @@ -13,7 +13,7 @@ use gpui::{ }; use crate::{ - ActiveTheme, global_state::GlobalState, input::Selection, text::TextViewMultiClickKind, + ActiveTheme, Root, global_state::GlobalState, input::Selection, text::TextViewMultiClickKind, text::node::LinkMark, text::selection::word_range_at, }; @@ -455,6 +455,7 @@ impl Element for Inline { if let Some(link) = Self::link_for_position(&text_layout, &links, event.position) { + Root::update(window, cx, |root, _, cx| root.end_text_selection(cx)); cx.stop_propagation(); cx.open_url(&link.url); } diff --git a/crates/ui/src/text/node.rs b/crates/ui/src/text/node.rs index af1069621..964ae6963 100644 --- a/crates/ui/src/text/node.rs +++ b/crates/ui/src/text/node.rs @@ -15,7 +15,7 @@ use markdown::mdast; use ropey::Rope; use crate::{ - ActiveTheme as _, Icon, IconName, StyledExt, h_flex, + ActiveTheme as _, Icon, IconName, Root, StyledExt, h_flex, highlighter::{HighlightTheme, LanguageRegistry, SyntaxHighlighter}, input::{InputEdit, Point, RopeExt as _}, text::{ @@ -816,7 +816,10 @@ impl Paragraph { .tooltip(move |window, cx| { Tooltip::new(title.clone()).build(window, cx) }) - .on_click(move |_, _, cx| { + .on_click(move |_, window, cx| { + Root::update(window, cx, |root, _, cx| { + root.end_text_selection(cx) + }); cx.stop_propagation(); cx.open_url(&link.url); })