anomalyco / anomalyco/opencode
TUI: single-tilde runs (\~x~\) vanish from rendered assistant text
@simonklee is already working on this.
Since Aug 25, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
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
35and3060%
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 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). - For readers the text silently changes meaning:
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's del rule /^(~~?)…/ is overly permissive here).
Related
- #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.
- #35835 fixed tilde/backtick adjacency but does not cover the plain
~x~swallowing case. - Same class of issue elsewhere: microsoft/vscode#323198, anthropics/claude-code#19251, open-webui/open-webui#16743.
Environment
- opencode v1.18.23 (
opencode-windows-x64) - Windows 10, Windows Terminal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.