anomalyco / anomalyco/opencode

TUI: single-tilde runs (\~x~\) vanish from rendered assistant text

Open
#44,935 1 comment 0 reactions 1 assignee View on GitHub

@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
  1. opencode (v1.18.23, Windows 10, Windows Terminal)
  2. Ask the model to output text like 按 3~5 倍放大,赢得 30~60% (any ~x~ fragment works)
  3. 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
  • #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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.