[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" />

View original on GitHub ↗

18 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/17314
  2. https://github.com/anthropics/claude-code/issues/17780
  3. https://github.com/anthropics/claude-code/issues/20509

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ivkabanov · 5 months ago

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

ivkabanov · 5 months ago

you can ask Claude to turn off syntax highlighting, and add this command to claude.md

martind0 · 5 months ago

Related issue:
#17892

Florian-Thake · 5 months ago

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.

martind0 · 5 months ago

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

Florian-Thake · 5 months ago

@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:

  • starting a new claude session: bug is there.
  • resuming a claude session with --resume : the bug is not there.

It even can be in the same Terminal instance.

Can somebody verify if resuming a claude session has proper syntax highlighting?

g-i-o-r-g-i-o · 5 months ago

It shows random colors when you use cmd, pwsh etc in conemu, tabby

g-i-o-r-g-i-o · 5 months ago

<img width="928" height="505" alt="Image" src="https://github.com/user-attachments/assets/9150c333-15d5-4ed6-ac9f-fc4ad7e6fe48" />

g-i-o-r-g-i-o · 5 months ago

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" />

Florian-Thake · 5 months ago

@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 ?

ivkabanov · 5 months ago
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.

wcswidth helped me in Windows Terminal.

g-i-o-r-g-i-o · 5 months ago
@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 ?

still broken, see next message

kvasanova · 5 months ago

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

  • When referring to markdown syntax characters literally (e.g. ##, **, #), always wrap them in backticks. Bare markdown characters without backticks get interpreted as formatting by the terminal

renderer, 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" />

g-i-o-r-g-i-o · 5 months ago

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.

rfmsanz-ethan · 5 months ago

+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.

ashwin-ant collaborator · 2 months ago

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.

github-actions[bot] · 2 months ago

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.