[Bug] User input line background width calculation error with CJK characters in v2.0.73
Bug Description
In version 2.0.73, the user input line background rendering has a regression compared to v2.0.72. The background box width is incorrectly calculated for Chinese (CJK) characters.
Environment
- Claude Code Version: 2.0.73
- OS: macOS (Darwin 24.6.0)
- Terminal: Default terminal
- Language: Chinese (Simplified)
Steps to Reproduce
- Install Claude Code v2.0.73
- Start a conversation
- Type Chinese text, e.g.,
你好,谢谢 - Observe the user input line background rendering
Expected Behavior
The background box should correctly cover the full width of the input text, as it did in v2.0.72.
Actual Behavior
The background box width is too short for Chinese text. The background appears "cut off" because CJK double-width characters are being calculated as single-width.
Root Cause Analysis
This appears to be a character width calculation issue:
- Half-width characters (English, numbers): 1 display unit ✓
- Full-width characters (CJK): 2 display units (but being calculated as 1) ✗
The rendering code likely uses string.length instead of a proper wcwidth implementation to calculate the background width.
Screenshots
<img width="966" height="334" alt="Image" src="https://github.com/user-attachments/assets/cf86e1ff-3d75-4d87-9a96-d7363f4f1b80" /> 2.0.73
<img width="1230" height="1092" alt="Image" src="https://github.com/user-attachments/assets/961ffdb6-0f9f-43ea-a98e-f183c329210d" /> 2.0.72
Workaround
Downgrade to v2.0.72:
npm install -g @anthropic-ai/claude-code@2.0.72This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗