Repository navigation
fix(tui): a URL wrapped onto an indented row is one clickable URL - #1309
Merged
Merged
Conversation
Clickable URLs are recovered from the rendered frame, which was built by concatenating every cell of every row. A terminal hard wrap starts the next row at column zero, so those URLs stitched back together; anything the renderer wrapped itself indents the continuation, and the indent's spaces terminated the URL run. The result was worse than an unlinked URL: clicking the first row opened a confident, truncated link, and the tail was not clickable at all, so nothing suggested the URL had been mis-read. Join rows on whether the row above used its last cell — content there means the width cut it off, so the row beneath continues it and its indent is layout rather than text. A row ending in blank cells ended on its own terms, and that padding still stops a URL from running into the line below. Blank and missing rows always break the run. This also makes the continuation clickable and underlined on hover, while leaving the skipped indent neither. Spec 0210.
This was referenced Aug 25, 2026
Merged
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.
The bug
Clickable URLs are recovered from the rendered frame (so a link stays clickable even inside a session that has grabbed the mouse). That frame was flattened by concatenating every cell of every row with no separator.
A terminal hard wrap starts the continuation at column zero, so those URLs stitched back together by accident. Anything the renderer wrapped itself — markdown bodies, bullet continuations, box-drawn panels — indents the continuation, and those indent spaces terminated the URL run.
Repro, width 23:
That's worse than not linking at all: the user gets a confident click that opens a truncated, usually 404-ing URL, and nothing about the dead tail suggests the link was mis-read.
Worth noting the existing
url_hit_reconstructs_wrapped_url_across_rowsonly passed because its first row happens to fill the bounds width exactly. The stitch was naive concatenation, with trailing padding accidentally acting as the terminator.The fix
Join rows on one signal — whether the row above used its last cell:
Keying on content in the last cell rather than on where the continuation starts covers both wrap styles, because both come from the same cause: content that ran out of width.
The continuation is now clickable and underlined on hover; the skipped indent is neither, which keeps hit-testing and highlighting in agreement.
Accepted tradeoff
A URL that happens to end exactly in a row's last cell will absorb the start of the row beneath it. That is rare, its blast radius is one wrong link, and narrowing it further would mean guessing at content rather than reading layout. The rule is deliberately conservative in the direction that matters — over-joining opens a wrong URL, which is worse than under-joining — so a line with room left over is never treated as continued.
Note this failure mode is not new: the old code joined row-end to next-row-column-zero unconditionally.
Risk checked
The signal would break if anything painted the last column inside the bounds. It doesn't:
capture_frame_textreads cell symbols, and the scroll overlay is a background tint that leaves symbols untouched.Tests
Three new, plus both pre-existing wrap tests still green:
url_hit_stitches_across_an_indented_continuation— both halves resolve to the whole URL from either row, underline starts at the first real character, and the indent itself is not a hit.url_hit_does_not_stitch_a_line_that_ended_on_its_own— a URL with padding after it does not swallow the prose below.url_hit_does_not_stitch_across_a_blank_row.Full workspace suite green (1459 CLI tests) apart from the pre-existing, unrelated
availability::auto_unavailable_when_only_a_subscription_credential_exists, which fails on any machine exportingOPENROUTER_API_KEY(missing from that test's scrub list since #1303).No recording: this is a hover/click interaction and vhs cannot drive a mouse.
Spec
0210-a-wrapped-url-is-one-url.md.Binaries
Only
crates/cliis touched → the relevant binary isconstruct:/Users/moon/agentd/.claude/worktrees/url-wrap-indent/target/debug/construct