[Bug] Inconsistent syntax highlighting in PowerShell terminal on Windows
Resolved 💬 18 comments Opened Jan 25, 2026 by phaselockedloop Closed Apr 19, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
Highlighting in windows is weird. Random words will be higlighted red, blue, etc... I'm using terminal in powershell.
Environment Info
- Platform: win32
- Terminal: windows-terminal
- Version: 2.1.19
- Feedback ID: 5797cd81-f38d-4f46-8dd5-03f2dd7d1183
<img width="300" height="210" alt="Image" src="https://github.com/user-attachments/assets/ca59bc63-2ae8-4d23-a90b-c2c5da216bdc" />
18 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Try asking Claude to turn off syntax highlighting.
You are lucky if you manage to read it, I was having a hard time reading blue text on a blue background, and other background colors were matching the text colors too
my bug report is here: https://github.com/anthropics/claude-code/issues/20509
you can ask Claude to turn off syntax highlighting, and add this command to claude.md
Related issue:
#17892
Hi, this is also reproducible when using cmd.exe inside the Windows Terminal instead of the PowerShell.
I have a "fix" / workaround for this bug:
Switching Text Measurement Mode to wcswidth fixed the issue. (restart of the Terminal required)
Settings -> Compatibility -> Text Measurement Mode -> wcswidth
When setting to the default "Grapheme Clusters" mode, the bug is present.
I tried setting it to wcswidth but it sadly didn't help, neither did telling Claude to turn off syntax highlighting. The only real fix for me is to downgrade to 2.1.2 or use WSL
@martind0 You are right, I most likely ran into a coincidence when I was verifying the issue last time.
Sorry for any confusion regarding this issue.
After testing I know now what was helping on my side:
It even can be in the same Terminal instance.
Can somebody verify if resuming a claude session has proper syntax highlighting?
It shows random colors when you use cmd, pwsh etc in conemu, tabby
<img width="928" height="505" alt="Image" src="https://github.com/user-attachments/assets/9150c333-15d5-4ed6-ac9f-fc4ad7e6fe48" />
seems to work correctly only on this windows terminal
https://apps.microsoft.com/detail/9n0dx20hk701?hl=it-IT&gl=IT
https://github.com/microsoft/terminal
<img width="733" height="681" alt="Image" src="https://github.com/user-attachments/assets/9fdf40c9-36a5-4a33-8189-1f11b6648cad" />
@g-i-o-r-g-i-o No, it won't. It is also broken in the Windows Terminal.
Could you verify, if the bug is present in new claude session VS. claude --resume ?
wcswidth helped me in Windows Terminal.
still broken, see next message
When Claude outputs bare markdown symbols as literal text, e.g.:
I used ## for headings and bold for emphasis
The terminal highlighter misinterprets them as formatting directives. Since they appear mid-paragraph, the highlighter enters a broken state where highlight offsets shift for all subsequent text. The
corruption is cumulative.
Wrapping them in backticks (
##,**) avoids the issue entirely.Fix — add this to your CLAUDE.md:
# Output Formatting
##,**,#), always wrap them in backticks. Bare markdown characters without backticks get interpreted as formatting by the terminalrenderer, which breaks highlight offsets for the rest of the output.
Not a renderer fix, but reliably prevents the issue on the Claude side.
Before:
<img width="455" height="134" alt="Image" src="https://github.com/user-attachments/assets/1b499394-f16e-40b5-b59c-38a30f292281" />
After:
<img width="615" height="401" alt="Image" src="https://github.com/user-attachments/assets/28762d3c-02fd-4287-b49d-7a47fda9cf2c" />
I retract my previous message, the bug is ALIVE, even with
wt.exe
pwsh.exe
Sometimes it breaks, obv more noticeable with longer messages... no way to fix it.
+1
Windows 11 Pro 25H2 26200.7462
Claude Code 2.1.38
Windows Terminal (using PowerShell)
This has been happening for several months for me, so I'm not sure which version caused the regression.
Also, the wcswidth "fix" made no difference.
This was fixed in v2.1.47 — Fixed bold/colored text shifting to the wrong characters on Windows due to a CRLF line-ending offset bug in the markdown renderer. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.
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.