Thai text (and other space-less scripts) misaligns/right-shifts on line wrap, especially when the terminal is resized
Bug: Thai text (and other space-less scripts) misaligns/right-shifts on line wrap, especially when the terminal is resized
Environment
- Claude Code CLI version: 2.1.235
- OS: Windows 11 Pro (10.0.26200)
- Terminal(s) tested: Windows Terminal, VS Code Integrated Terminal
- Terminal font/size: reproduced across multiple fonts (Cascadia Mono, Consolas, Courier New) and sizes — not font-related
Description
When Claude's output contains Thai text mixed with English, long Thai passages do not wrap cleanly at the left margin like English text does. Lines appear to shift right, get padded with extra whitespace, or become misaligned relative to surrounding lines — especially noticeable when the terminal window is resized (narrowed/widened) after the text has already been printed.
This does not reproduce with pure-English output. It also reproduces consistently across different terminal apps (Windows Terminal, VS Code integrated terminal) and different fonts/sizes, which rules out font rendering or terminal font-fallback as the cause.
Suspected root cause
Thai script has no spaces between words. A word-boundary-based line-wrapping algorithm (wrapping only at whitespace, as is typical for English) will treat an entire Thai sentence as a single unbreakable "word." When that unbreakable chunk doesn't fit the remaining line width, the wrapping/padding logic appears to mishandle it — producing right-shifted or jumbled lines instead of breaking at a Thai grapheme/character boundary.
Steps to reproduce
- Open Claude Code in Windows Terminal or VS Code's integrated terminal.
- Have Claude output a long paragraph mixing Thai and English text (several sentences).
- Resize the terminal window (narrow it, then widen it) after the text is printed, or observe the initial wrap of a long Thai paragraph.
- Observe: lines are not consistently left-aligned; some lines appear shifted right or padded oddly, unlike the English-only case.
Expected behavior
Thai (and other scriptio-continua languages without word-spacing, e.g. Lao, Khmer, Japanese, Chinese) should wrap at character/grapheme-cluster boundaries and stay flush with the left margin, the same as English text does, and reflow correctly when the terminal is resized.
Additional notes
- Confirmed not a font issue: reproduced with Cascadia Mono, Consolas, and Courier New at multiple sizes (9–16pt) with and without a Thai-capable fallback font (Leelawadee UI) configured.
- Confirmed not a Windows Terminal vs VS Code terminal issue: reproduces in both.
- Screenshots available on request (not attached here).