Bug
When an assistant text part contains content wrapped in single tildes (e.g. 3~5 or 30~60%), the TUI markdown renderer swallows the ~ (and sometimes content between delimiters). Data is intact in the session store; this is purely a rendering-layer issue.
Example from a real session (assistant text part, verified via opencode.db):
- Stored text:
按 3~5 倍放大,应用在选择器中赢得 30~60% - Rendered as:
按 35 倍放大,应用在选择器中赢得 3060%
The same part contained 19 occurrences of ~ (+15%~30%, ~1,100/天, 7 功能 ~26,000 次/天 ...); all were swallowed on display. Verified the raw bytes: 33 7E 35 and 33 30 7E 36 30 25 — the 0x7E is present in storage, absent from screen.
Repro
opencode (v1.18.23, Windows 10, Windows Terminal)- Ask the model to output text like
按 3~5 倍放大,赢得 30~60% (any ~x~ fragment works) - Observe rendered output shows
35 and 3060%
Live reproduction (v1.18.23, this session)
Assistant message sent (contains 10 tildes total: 6 single + 2 double runs):
- 单波浪号测试: 3~5 倍、30~60%、~1,100/天、a~b~c、~/Downloads/foo
- 双波浪号测试: ~~这段应该被删除线处理~~
What actually renders in the TUI (copy-pasted from screen, 0 tildes remain):
- 单波浪号测试: 35 倍、3060%、1,100/天、abc、/Downloads/foo
- 双波浪号测试: 这段应该被删除线处理
Notes:
- Every
~ is swallowed. Single tildes are paired across the whole line into del spans: 3~5 倍、30~60% pairs as one span, ~1,100/天、a~ as another, and the trailing ~ of a~b~c pairs all the way with the tilde in ~/Downloads/foo (strikethrough-styling c、 in between). - For readers the text silently changes meaning:
3~5 倍 reads as 35 倍, 30~60% as 3060%.
Expected
Single tildes pass through as literal text. Only ~~text~~ should trigger strikethrough (per GFM spec, ~x~ is not strikethrough; marked's del rule /^(~~?)…/ is overly permissive here).
Related
Environment
- opencode v1.18.23 (
opencode-windows-x64) - Windows 10, Windows Terminal
Bug
When an assistant text part contains content wrapped in single tildes (e.g.
3~5or30~60%), the TUI markdown renderer swallows the~(and sometimes content between delimiters). Data is intact in the session store; this is purely a rendering-layer issue.Example from a real session (assistant text part, verified via
opencode.db):按 3~5 倍放大,应用在选择器中赢得 30~60%按 35 倍放大,应用在选择器中赢得 3060%The same part contained 19 occurrences of
~(+15%~30%,~1,100/天,7 功能 ~26,000 次/天...); all were swallowed on display. Verified the raw bytes:33 7E 35and33 30 7E 36 30 25— the0x7Eis present in storage, absent from screen.Repro
opencode(v1.18.23, Windows 10, Windows Terminal)按 3~5 倍放大,赢得 30~60%(any~x~fragment works)35and3060%Live reproduction (v1.18.23, this session)
Assistant message sent (contains 10 tildes total: 6 single + 2 double runs):
What actually renders in the TUI (copy-pasted from screen, 0 tildes remain):
Notes:
~is swallowed. Single tildes are paired across the whole line intodelspans:3~5 倍、30~60%pairs as one span,~1,100/天、a~as another, and the trailing~ofa~b~cpairs all the way with the tilde in~/Downloads/foo(strikethrough-stylingc、in between).3~5 倍reads as35 倍,30~60%as3060%.Expected
Single tildes pass through as literal text. Only
~~text~~should trigger strikethrough (per GFM spec,~x~is not strikethrough; marked'sdelrule/^(~~?)…/is overly permissive here).Related
~text~and~~text~~render as strikethrough #26138 (Desktop, closed as not planned) — a comment there confirms the same issue exists in TUI mode; this issue provides a concrete TUI repro and shows content loss, not just strikethrough styling.~x~swallowing case.Environment
opencode-windows-x64)