[BUG] Syntax highlighting color boundaries misaligned with CJK (Japanese) characters in code blocks

Resolved 💬 3 comments Opened Feb 18, 2026 by grey-node Closed Feb 21, 2026

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?

Description

When Claude Code outputs code blocks containing CJK characters (e.g., Japanese), the syntax highlighting colors are
misaligned. The color change boundaries appear to be offset from where they should be, causing colors to shift into
the middle of characters or adjacent tokens.

Environment

  • Claude Code CLI
  • Windows 11
  • Windows Terminal + PowerShell 7
  • Language: Japanese (multi-byte / double-width characters)

Expected behavior

Color boundaries should align correctly with token boundaries regardless of character width.

Actual behavior

Color change positions are shifted/offset when CJK (double-width) characters are present. It appears the highlighter
calculates string positions assuming each character is 1 column wide, not accounting for the 2-column width of CJK
characters.

What Should Happen?

Description

When Claude Code outputs code blocks containing CJK characters (e.g., Japanese), the syntax highlighting colors are
misaligned. The color change boundaries appear to be offset from where they should be, causing colors to shift into
the middle of characters or adjacent tokens.

Error Messages/Logs

Steps to Reproduce

Steps to reproduce

  1. Ask Claude Code a question that results in a code block containing mixed CJK and ASCII text, such as shell comments

in Japanese:

最新設計書を一時DLして処理し、終わったら自動削除
python script.py download-all
→ C:/work/downloads/ に一時保存

  1. Observe that the syntax highlighting colors do not align with the correct token boundaries.

Notes

This is likely a wcwidth issue in the component that inserts ANSI escape sequences for syntax highlighting. CJK
characters occupy 2 terminal columns but may be counted as 1 when calculating insertion positions.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.45

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗