mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 13:06:00 +03:00
[GH-ISSUE #609] lineStarts returns column offset instead of byte offset when wrapping multi-byte text #165
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#165
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 @zenyr on GitHub (Feb 1, 2026).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/609
Problem
After #255 fix, CJK/emoji text renders correctly in most cases. However,
lineInfo.lineStartsstill returns column offsets instead of byte offsets when text wraps. This causes character corruption at line boundaries.Korean text wrap (representative case)
lineStarts[0, 4]"흐�""��도"[0, 6]"흐름""도"Chinese text wrap
lineStarts[0, 4]"你�""��世界"[0, 6]"你好""世界"Korean with leading ASCII
lineStarts[0, 5]" 안�""��a"[0, 7]" 안녕""a"Flag emoji
lineStarts[0, 4]"🇰""🇷🇯🇵🇨🇳"[0, 16]"🇰🇷🇯🇵""🇨🇳"Skin tone emoji
lineStarts[0, 4, 8]"👋""🏻""👋🏿hi"[0, 8, 16]"👋🏻""👋🏿""hi"AS-IS splits skin tone modifier from base emoji.
Mixed keycap + CJK
lineStarts[0, 3]"1�""�⃣한글"[0, 10]"1️⃣한""글"Long Korean (multiple wraps)
lineStarts[0, 6, 12]"가나""다라""마바사"[0, 9, 18]"가나""다라""마바사"Happens to display correctly but byte offsets are still wrong (6≠9, 12≠18).
Root Cause
In
text-buffer-view.zig,cached_line_startswas populated usingchar_offset(display column width) instead of tracking actual byte position through the wrap logic.Related
@simonklee commented on GitHub (Mar 2, 2026):
tests/fix-609-cases