fix(tui): rewrite #N ticket refs as markdown links, restore full markdown rendering#24
Merged
Merged
Conversation
Replaces the splitOnTicketRefs + inline <TicketRef> approach with a simpler strategy: rewrite #N → [#N](https://hivemind.grunt.si/tasks/N) in assistant text and feed through the markdown renderer. Fixes: - Bug 1: HIVEMIND_UI_BASE default changed to https://hivemind.grunt.si - Bug 3: full markdown formatting restored for paragraphs containing #N refs (bold, italic, code, lists no longer lost to plain <span> fallback) - The markdown renderer linkifies [text](url) into OSC-8 hyperlinks, so refs remain clickable Bug 2 (hover preview) tracked separately — will restore via renderNode hook.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
terrxo
added a commit
that referenced
this pull request
Jun 1, 2026
…mouse overlay (anomalyco#331) PR #24 fixed #N rendering by rewriting refs to markdown links fed through <markdown>, but that killed the hover-card preview: OpenTUI inline link chunks are TextNodes that can't hold mouse listeners (only block-level Box/Text are on the mouse hit-grid). Restore hover (Model A) without touching PR #24's rendering: wrap the existing TextPart <box> with onMouseMove/onMouseOut, translate absolute mouse coords -> local row/col via the box's screenX/Y + width, then map to the nearest ticket ref using a source-text scan. Drives the existing (intact-but-untriggered) TicketHoverCard context. No change to wrap layout, so the anomalyco#250 fix is preserved. New: ticket-ref-scan.ts (scanTicketRefs + resolveRefAt + nearestRefId).
terrxo
added a commit
that referenced
this pull request
Jun 1, 2026
…overlay (anomalyco#331) Nik reported two bugs on the prior approach: (1) the markdown rewrite [#N](url) leaked the literal URL into the visible text, (2) hover was 'all over the place'. Root cause confirmed by build-test (test harness, no tree-sitter — same as the real app's <markdown>): a [#N](url) link renders its URL literally; NO markup form (link/bold/code) conceals it. Only PLAIN #N is leak-free. The hover drift came from estimating wrap geometry against the rewritten content, whose [#N](url) strings were far longer than the visible text. Fix (Option 1 — keep PR #24's wrap-correct <markdown> flow, drop the rewrite): - Render source text directly as plain #N. No URL leak, wrap unchanged. - Line-based hover resolver: cursor row -> source line -> ref on that line (single = exact; multi = nearest by column). Now accurate because the scanned/estimated text IS the visible text. - Click-to-open via overlay onMouseUp (replaces the lost OSC-8 click). - HIVEMIND_UI_BASE default -> https://hivemind.grunt.si. Tests: 13 resolver unit tests + full TUI suite (146 pass) green; typecheck clean.
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.
Summary
Replaces the split+inline- approach with a simpler strategy: rewrite
#N→[#N](https://hivemind.grunt.si/tasks/N)in assistant text and feed through the markdown renderer.Changes
TextPart): Instead of splitting text on#Nrefs and falling back to plain<span>text (losing all markdown formatting) when any ref is present, rewrite each#Nas a markdown link and pass the entire string through<markdown>. Retired thesplitOnTicketRefsfunction andTicketRefimport.HIVEMIND_UI_BASEdefault fromhttp://localhost:5173→https://hivemind.grunt.siBugs fixed
https://hivemind.grunt.si(env override preserved)#Nrefs<markdown>Bug 2 (hover preview) is tracked separately — restoring it requires a
renderNode-hook spike.Verification
bun run typecheckpasses (19/19 tasks).