TerminalCapabilities already tracks hyperlinks: boolean and returns true
for Ghostty, Kitty, WezTerm, and iTerm2, but nothing generated OSC 8
sequences. This completes that stub.
Changes to packages/tui:
- terminal-image.ts: add hyperlink(text, url) and setCapabilities()
- index.ts: export hyperlink and setCapabilities
- utils.ts: extend AnsiCodeTracker to track active OSC 8 URLs
- process() now handles OSC 8 open/close sequences
- getActiveCodes() re-emits the OSC 8 open at each line start
- getLineEndReset() closes the OSC 8 hyperlink before each line break
This ensures hyperlinks wrap correctly across multiple lines.
- components/markdown.ts: link renderer uses hyperlink() when
getCapabilities().hyperlinks is true; falls back to (url) text
- Tests: new wrap-ansi tests for OSC 8 line-wrapping; terminal-image
tests for hyperlink(); markdown tests covering both code paths;
table-cell width test pinned to hyperlinks:false (checks raw columns)
closes#3239
Co-authored-by: AI (Pi/Claude Sonnet 4.6) <noreply@pi.dev>
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
Tests assumed renders complete synchronously after requestRender() +
nextTick + flush(), but commit 6f5f37f8 changed requestRender() to
schedule via setTimeout with a 16ms minimum interval. Tests reading
viewport state before doRender() runs saw stale data.
Add VirtualTerminal.waitForRender() helper that waits for the throttled
render to settle (nextTick + 20ms + xterm flush), and replace all
terminal.flush() calls after render-triggering actions with it.
Fixes 8 failing tests across overlay-short-content, tui-render, and
markdown test suites.
Headings applied styling (bold+cyan) as an outer wrapper around the
result of renderInlineTokens. When inline elements like codespan emitted
ANSI resets, the outer heading style was killed and only the default
text style was restored via stylePrefix.
Fix: pass a heading-specific InlineStyleContext into renderInlineTokens
so each text segment gets heading styling directly, and stylePrefix
restores heading style after inline elements.
* fix(tui): blockquote multiline rendering and wrapping
Fix two bugs in blockquote rendering:
1. ANSI codes split incorrectly on newlines - when text tokens contain
newlines, applyDefaultStyle() wrapped the entire string including the
newline in ANSI codes. Any caller splitting by \n would break the codes.
Fixed by splitting text by newlines before styling in renderInlineTokens().
2. Wrapped blockquote lines lost the │ border - long blockquote lines
that wrapped to multiple lines only had the border on the first line.
Fixed by wrapping within the blockquote case and adding border to each line.
* test(tui): add test for inline formatting inside blockquotes
Autolinked emails like user@example.com were rendered as
'user@example.com (mailto:user@example.com)' because the comparison
token.text === token.href failed (text lacks mailto: prefix).
Now strips mailto: prefix before comparing, so autolinked emails
display without redundant URL in parentheses.
- Add generateDiffString() function in edit tool to create unified diffs with line numbers and 4 lines of context
- Store only the formatted diff string in tool result details instead of full file contents
- Update tool-execution renderer to parse and colorize the diff string
- Filter out message_update events from session saving to prevent verbose session files
- Add markdown nested list and table rendering tests