Repository navigation
fix(tui): link bare URLs in prose and prompts - #712
Merged
Merged
Conversation
A URL only carried a destination when it was written as markdown, so `https://example.com` in an answer, in tool output, or pasted into a prompt rendered as inert text: no underline and nothing to click. Scan prose and prompt rows for bare `http(s)://` runs and attach the same destination an explicit markdown link carries. `destination_for` stays the single gate, so detection proposes and policy still decides. Headings and table cells stay plain on purpose. A heading uppercases its label, so a destination there would point at text that no longer matches it, and a table cell drops its link table on the way into the row, so an underline there would promise a click that cannot happen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A URL only carried a destination when it was written as markdown link syntax. A bare
https://example.comin an answer, in tool output, or pasted into a prompt rendered as inert text: no underline, and nothing to click. It is the form a model writes most often, and the only form a prompt can contain, since prompt rows are not a markdown path at all.This scans prose and prompt rows for bare
http(s)://runs and attaches the same destination an explicit markdown link carries.How
links::autolink_matchesproposes byte ranges;destination_forremains the single gate, so detection never widens what may be emitted (file:,mailto:,javascript:stay plain).links::link_label_styleis now the one definition of how a link label looks, shared by the markdown path, the bare-URL path and the prompt path.markdown::push_spanautolinks body text;user_message_gutterreturnsHyperlinkLines so a pasted URL keeps its columns through the transcript's indent.Deliberately out of scope
end_celldrops the link table on the way into the row, so an underline there would promise a click that cannot happen. Autolinking would have made that worse.Both are documented in the new
FORGE-DESIGN.mdrule next to "the underline is a promise".Tests
11 new tests: URL detection (sentence punctuation, bracket balance, quote wrapping, mid-word runs, hostless schemes, refused schemes), bare URLs in prose, two per row, a URL wrapping across rows, the heading exclusion, and a URL pasted into a prompt.
cargo test -p forge-tui: 1419 passed, 5 failed. All 5 are pre-existing environment failures in this sandbox (sandbox denied command: ... this host refused to apply confinement, from the background-task tests), unrelated to this change.cargo fmt --checkclean,cargo clippy -p forge-tuiclean.