mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 04:55:58 +03:00
[GH-ISSUE #651] wrapMode "word" breaks mid-word with multi-byte UTF-8 text #176
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#176
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @la55u on GitHub (Feb 9, 2026).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/651
Description
wrapMode: "word"onTextRenderablebreaks words mid-character when text contains multi-byte UTF-8 characters (e.g. Hungarian accented characters like á, é, ö, ü). The optimal line-breaking algorithm appears to use byte offsets instead of display-width offsets when computing wrap positions.Minimal Reproduction
Actual output
Line 1 breaks at 31 visible chars (36 bytes) even though
"közül. Azóta"(37 chars) fits within width 40. The word"újra"on line 2 is split into"újr"/"a".Expected output
All breaks occur at whitespace boundaries. This is the output produced when accented characters are replaced with their ASCII equivalents (same char count, fewer bytes):
Key observations
"é".repeat(40)fits on a single line atwidth: 40.widthMethod: "unicode"andwidthMethod: "wcwidth"produce the same broken output.Environment
@simonklee commented on GitHub (Feb 21, 2026):
I can't reproduce this in HEAD anymore. I wonder if
f891d9631dfixed it. I'm not 100%.pre-f891d963 output I get is:
So before that fix I see a formatting issue (leading spaces on wrapped continuation lines), but not the exact mid-word split.