[BUG] Intermittent Markdown Formatting Misalignment
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Markdown formatting (bold, italic, code) renders at incorrect character positions intermittently. Random 2-4 character spans get styled instead of the intended words. The bug is inconsistent - sometimes formatting works correctly, sometimes it doesn't, even within the same response.
Behavior:
- Short responses tend to render correctly
- Longer responses with multiple formatting elements intermittently break
- Within the same response, some formatting is correct, some is wrong
- Styling appears shifted/misaligned from intended position
Example:
When Claude intends to write:
The Go programming language was designed for simplicity.
What actually renders (sometimes):
The Go programming language was designed for simplicity.
The bold styling is applied to the wrong character range.
Likely Cause:
Appears to be a streaming/chunking issue where ANSI escape codes get misaligned based on chunk boundaries during rendering.
Related:
v2.1.6 changelog mentioned fix for "text styling (bold, colors) getting progressively misaligned" - this bug differs: it's intermittent from the start, not progressive over time.
What Should Happen?
Markdown formatting (bold, italic, code) should render at the correct character positions consistently. The styled text should match exactly what Claude intended to format.
Error Messages/Logs
Steps to Reproduce
- Start a new Claude Code session
- Ask Claude to write several paragraphs with intentional bold/italic formatting
- Observe that formatting sometimes appears at wrong positions
- Short responses may work; longer ones more likely to fail
- Bug can appear from the very first response (not progressive)
- Tested across PowerShell 7, PowerShell 5.1, CMD (Windows Terminal and conhost) - bug appears in ALL terminals
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.7
Claude Code Version
2.1.19
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Tested across multiple terminals (PowerShell 7, PowerShell 5.1, CMD via Windows Terminal and conhost) - bug appears in ALL of them, ruling out terminal-specific causes. The issue is in Claude Code's Ink/React TUI renderer generating misaligned ANSI escape codes.
Screenshots
<img width="1254" height="653" alt="Image" src="https://github.com/user-attachments/assets/57d5c645-e480-4e67-942d-16271a1ed9f0" />
<img width="921" height="597" alt="Image" src="https://github.com/user-attachments/assets/984fed50-266a-4516-8854-ad4ebf0f085c" />
5 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Update: Even more extreme case observed
This screenshot shows an even more severe manifestation of the bug - entire text blocks rendered with rainbow gradient coloring where individual characters cycle through different colors:
!Extreme formatting bug
Note: The code block at top is syntax highlighting (expected). But the text below shows:
This is NOT a duplicate of the other issues - those show minor misalignment. This shows the underlying rendering bug in its most extreme form.
---
Screenshot to be uploaded
Screenshot: Rainbow gradient text rendering bug
The attached screenshot shows an extreme case where normal prose text renders with rainbow gradient coloring - individual characters cycling through red → yellow → green → cyan → blue.
This is clearly the same underlying bug (ANSI escape code misalignment) in its most severe form.
Image: See attached in next comment (GitHub CLI limitation - uploading via web)
Closing as duplicate of #17892 - adding new screenshot there instead.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.