MoonshotAI / MoonshotAI/kimi-cli
Bug: Text wrapping cuts words mid-word when exceeding line length
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
What version of Kimi Code CLI is running?
1.46.0
Which open platform/subscription were you using?
Kimi Code
Which model were you using?
Kimi-k2.6
What platform is your computer?
Darwin 25.5.0 arm64 arm
What issue are you seeing?
Description
When typing or displaying long lines in the Kimi CLI, words are visually cut off in the middle when the text exceeds the visible line width. Part of the word remains on the current line, and the rest wraps to the next line, breaking readability.
This appears to be related to terminal width calculation — the CLI may not be accounting for scrollbar width, padding, or East Asian Width (EAW) characters correctly.
What steps can reproduce the bug?
- Open Kimi CLI in a terminal window (e.g., iTerm2, Windows Terminal, GNOME Terminal).
- Resize the terminal to a standard width (e.g., 80–100 columns).
- Type a long sentence or prompt that exceeds the visible line width.
- Observe that the word at the wrap boundary is split in the middle rather than wrapping at a word boundary or character boundary.
What is the expected behavior?
Expected Behavior
- Text should wrap cleanly at word boundaries (preferred) or at least at character boundaries.
- The CLI should accurately calculate the drawable terminal width, accounting for scrollbars, borders, and full-width characters.
Actual Behavior
- Words are split mid-word at the line boundary.
- The remaining portion of the word appears on the next line.
- Issue is more noticeable when CJK characters, emojis, or other full-width characters are present.
Additional information
Additional Context
- The issue seems correlated with terminal scrollbar presence — disabling the scrollbar sometimes reduces the frequency.
- This may be related to East Asian Width (EAW) miscalculation: CJK characters and certain symbols occupy 2 terminal columns, but the wrapping logic may treat them as 1 column.
- Similar wrapping bugs have been observed in other CLI tools (e.g., Claude Code, Hermes) that use shared TUI libraries.
Possible Root Cause
- The CLI likely queries the terminal width via ioctl(TIOCGWINSZ) or a TUI library but does not subtract the width consumed by:
- Scrollbars (1–2 columns)
- Border/padding
- Full-width characters (2 columns each)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by reproducing the wrap at a narrow terminal width with long text containing CJK characters or emojis, then locate the CLI's wrapping and terminal-width calculation code. Done means text wraps at word or character boundaries without mid-word cuts and accounts for full-width characters and available drawable width.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100