text: Allow applications to handle TextView link clicks (#2621)
## Description Adds an optional `TextView::on_link_click` callback carrying the resolved URL, mouse button, and keyboard modifiers. Applications can route rendered Markdown or HTML links internally and distinguish ordinary, modified, middle, and right clicks. When a handler is installed, the click is consumed and the application owns routing. Without a handler, links retain the existing `App::open_url` behavior. The implementation covers inline text links and linked images. Linked images register both primary and auxiliary click listeners so middle and right clicks reach the callback; right clicks without a handler retain the prior fallback behavior. Closes #2620. ## Testing Exact candidate `11bb95f2` on Rust 1.97.1: - `cargo test -p gpui-component text_view --lib`: 12 passed - `cargo test -p gpui-component`: 347 passed - `cargo clippy -p gpui-component --all-targets -- -D warnings` - rendered linked-image regression proves left, middle, and right delivery to the custom handler and proves that the default URL opener is not called The current public head is green on Windows, macOS, and Linux. ## AI Assistance The implementation and tests were AI-assisted by Friday. Chris Hynes defined the API requirements, directed the auxiliary-click fixes, and owns the final review. --------- Co-authored-by: Friday <260232009+buildfriday@users.noreply.github.com> Co-authored-by: Jason Lee <huacnlee@gmail.com>
C
Chris Hynes committed
3cb3cc139619ce704387b69deb17822b0fc22497
Parent: dfe3417
Committed by GitHub <noreply@github.com>
on 8/10/2026, 1:27:36 AM