Repository navigation
Description
Markdown links rendered in the Rune Agent dialogue TUI are not clickable. Clicking one starts a text selection instead of following the link.
The SDK already supports link clicks: the markdown handler accepts an OnLinkClick option and the markdown component can hit-test a coordinate to a link. The dialogue TUI simply never wires clicks to its markdown components.
Current state
- All mouse events route through the dialogue's mouse delegate, whose
OnActionalways returnsfalse. It only handles selection and scrolling on a flattened cell grid. - Sent messages and prompt bodies render a bare markdown component with no handler at all.
- Streamed received messages do wrap markdown in the SDK markdown handler, but without a link-click option, and the delegate never invokes that handler's
OnAction.
Proposal
- Accept a link-click callback in the component config (
func(*url.URL) bool), documented so that nil ignores clicks and the package stays service-agnostic. - Add a hit-test that maps a click coordinate to the specific markdown component in the message list and asks it for the link at that point.
- Handle left clicks in the mouse delegate: resolve a link, parse it, and invoke the callback. Returning
truesuppresses selection-start so the click does not also begin a drag. - Wire the real callback at the extension's dialogue construction site, copying http/https URLs to the clipboard and notifying, mirroring the equivalent behavior in the IDE.
Local #anchor scrolling is out of scope; bare fragment links should fall through harmlessly.
Where to look
cmd/rune-agent/dialogue/dialoguetui/config.go- where the new config field belongs, next to the existing markdown config.cmd/rune-agent/dialogue/dialoguetui/component.go- the three markdown render sites (sent message, streamed receive, prompt body) and the message-list iteration patterns to copy for the hit-test.cmd/rune-agent/dialogue/dialoguetui/mouse_delegate.go- the delegate and itsOnAction.cmd/rune-agent/dialogue/dialoguetui/handler.go- delegate construction, and the place where the message-area offset is already subtracted from the event, so the delegate's coordinates are already in message-viewport space.
Notes for contributors
Tests belong in the existing mouse test files, using a capturing callback. Worth covering: a click on a link fires the callback and returns true; a click on plain text in the same message does not and returns false so selection still starts; links work in all three render sites; out-of-bounds clicks return false.
Activity
Fix clickable markdown links in agent dialogue TUI