fix(tui): don't swallow Kimi/Qwen ~! ~? kaomoji as subscript spans#13715
Merged
Conversation
The inline markdown regex had `~([^~\s][^~]*?)~` for Pandoc-style subscript
(H~2~O, CO~2~). On models that decorate prose with kaomoji like `thing ~!`
and `cool ~?` — Kimi especially — the opener `~!` paired with the next
stray `~` on the line and dim-formatted everything between them with a
leading `_` character, mangling markdown output.
Tighten the pattern to short alphanumeric-only content (`~[A-Za-z0-9]{1,8}~`)
since real subscript never contains punctuation, spaces, or long runs.
Same tightening applied to stripInlineMarkup so width measurement stays
consistent. Classic CLI was unaffected because it renders these literally.
4 tasks
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
…wn-tilde-subscript fix(tui): don't swallow Kimi/Qwen ~! ~? kaomoji as subscript spans
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
…wn-tilde-subscript fix(tui): don't swallow Kimi/Qwen ~! ~? kaomoji as subscript spans
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…wn-tilde-subscript fix(tui): don't swallow Kimi/Qwen ~! ~? kaomoji as subscript spans
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…wn-tilde-subscript fix(tui): don't swallow Kimi/Qwen ~! ~? kaomoji as subscript spans
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…wn-tilde-subscript fix(tui): don't swallow Kimi/Qwen ~! ~? kaomoji as subscript spans
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
User report — brand-new build, Konsole terminal, mostly Kimi:
The inline markdown regex has a Pandoc-style subscript alternative (
H~2~O) defined as~([^~\\s][^~]*?)~. That's too permissive:~!is a valid opener (first char!isn't whitespace or tilde) and pairs with the next stray~on the line. So a message like:renders as dim text from the first
~!throughinvestigation~, with a leading_prefix from the subscript render path. You can see the_in the reporter's screenshot atinvestigation_!.Fix
Tighten the subscript pattern to
~([A-Za-z0-9]{1,8})~— short, alphanumeric-only content. Real Pandoc subscript isH~2~O/CO~2~/X~n~, never punctuation or spaces. Matches:H~2~O→ matches~2~✓CO~2~→ matches~2~✓X~n~→ matches~n~✓Aww ~! blah ~!→ no match ✓ (regression fixed)cool ~? yeah ~?→ no match ✓~good idea~→ no match ✓ (whitespace inside bails out)Same tightening applied to
stripInlineMarkupso width measurement stays aligned. Prior fix b17eb949 was for_..._intraword italics — a different regex. This one targets the tilde path.Test plan
npm test(167/167, incl. 5 new markdown cases)npm run type-checkcleannpm run lintclean on touched files