This repository was archived by the owner on Aug 17, 2026. It is now read-only.
Repository navigation
Commit 8654031
committed
fix(tui): TicketRef renders inline so text-wrap layout is correct (anomalyco#250) (#22)
Refs (anomalyco#229, anomalyco#243, anomalyco#246, ...) were landing on the wrong visual line in
assistant messages with multiple inline refs. Root cause: the rendering
path split each paragraph into per-segment widgets and laid them out
under `<box flexDirection="row" flexWrap="wrap">`. Every segment —
whether a markdown chunk or a TicketRef `<text>` — became its own flex
item, and the flex-wrap engine reordered items per-item instead of
flowing characters per-line. Result: `anomalyco#227` lands at end-of-next-line,
`anomalyco#243` floats at end of an unrelated line, `anomalyco#246` duplicate-renders.
Fix: render a paragraph containing #N refs as a single `<text>` block
with inline `<span>` (text) and `<a href=...>` (ref) children. Both
are OpenTUI `TextNodeRenderable`s — they participate in the parent
`<text>`'s character-level wrap math, so refs flow correctly with
surrounding prose.
Trade-off (consistent with the original splitOnTicketRefs comment):
paragraphs that contain a #N ref no longer render inline markdown
formatting (bold/italic/code). Plain-text paragraphs (the fast-path)
keep full markdown rendering as before. This was the trade-off the
original code documented; the previous flex-row implementation didn't
honor it because each markdown block was its own block-level item.
Hover-card preview is dropped for now: OpenTUI TextNode (`<a>`, `<span>`)
doesn't accept its own mouse-event listeners — they're part of the
parent `<text>`'s render. The terminal still renders `#N` as a real
OSC-8 hyperlink (⌘-click in iTerm opens hivemind-ui at /tasks/<id>),
which preserves the click affordance. The hover-card component itself
is left mounted but unused; reintroducing the hover via a coordinated
overlay anchored to TextRenderable cursor coords is out of scope here.
Closes anomalyco#250.
Verified:
- bun typecheck clean
- All 50 TUI tests pass (test/cli/cmd/tui/)
- All 399 cli tests pass (1 unrelated pre-existing help-snapshot failure
from the opencode→gruntcode rebrand, not introduced here)1 parent 0ee497f commit 8654031
2 files changed
Lines changed: 35 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
10 | 19 | | |
11 | | - | |
12 | 20 | | |
13 | | - | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
17 | | - | |
18 | | - | |
19 | 24 | | |
20 | 25 | | |
21 | | - | |
22 | 26 | | |
23 | 27 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
36 | 31 | | |
37 | 32 | | |
38 | | - | |
| 33 | + | |
39 | 34 | | |
40 | 35 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1682 | 1682 | | |
1683 | 1683 | | |
1684 | 1684 | | |
1685 | | - | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
1686 | 1699 | | |
1687 | | - | |
1688 | | - | |
1689 | | - | |
1690 | | - | |
1691 | | - | |
1692 | | - | |
1693 | | - | |
1694 | | - | |
1695 | | - | |
1696 | | - | |
1697 | | - | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
1702 | | - | |
| 1700 | + | |
1703 | 1701 | | |
1704 | | - | |
| 1702 | + | |
1705 | 1703 | | |
1706 | 1704 | | |
1707 | 1705 | | |
| |||
0 commit comments