[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" />
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗