You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for looking into this. I think the root cause for something like this would rather be in the renderer.zig for the ansi output, or width calculations in utf8.zig. Setting a default background prevents text from ever being rendered on transparent terminal background.
Oh, okay. I'll attach my system configuration here:
I also found this issue on Windows 11 Powershell / CMD environment too.
I've made a tangent PR (adding React test suite with skipped tests) on #262.
❯ fastfetch
..' jinhyeok
,xNMM. -----------------------------------------
.OMMMMo OS: macOS Sequoia 15.6.1 arm64
lMM" Host: MacBook Pro (14-inch, 2023)
.;loddo:. .olloddol;. Kernel: Darwin 24.6.0
cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 7 days, 19 hours, 46 mins
.KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 230 (brew), 16 (brew-cask)
XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: zsh 5.9
;MMMMMMMMMMMMMMMMMMMMMMMM: Display (Color LCD): 3024x1964 @ 120 Hz (as 1512x982) in 14" [Built-in] *
:MMMMMMMMMMMMMMMMMMMMMMMM: Display (RTK UHD HDR): 3360x1890 @ 60 Hz (as 1680x945) in 24" [External]
.MMMMMMMMMMMMMMMMMMMMMMMMX. Display (LG HDR 4K): 3840x2160 @ 60 Hz (as 1920x1080) in 27" [External]
kMMMMMMMMMMMMMMMMMMMMMMMMWd. Display (LG HDR 4K): 3840x2160 @ 60 Hz (as 1920x1080) in 27" [External]
'XMMMMMMMMMMMMMMMMMMMMMMMMMMk DE: Aqua
'XMMMMMMMMMMMMMMMMMMMMMMMMK. WM: Quartz Compositor 278.4.7
kMMMMMMMMMMMMMMMMMMMMMMd WM Theme: Multicolor (Light)
;KMMMMMMMWXXWMMMMMMMk. Font: .AppleSystemUIFont [System], Helvetica [User]
"cooc*" "*coo'" Cursor: Fill - Black, Outline - White (32px)
Terminal: tmux 3.4
CPU: Apple M2 Max (12) @ 3.50 GHz
GPU: Apple M2 Max (38) @ 1.40 GHz [Integrated]
❯ ghostty --version
Ghostty 1.3.0-main+3f75c66e8
Version
- version: 1.3.0-main+3f75c66e8
- channel: tip
Build Config
- Zig version : 0.15.2
- build mode : .ReleaseFast
- app runtime : .none
- font engine : .coretext
- renderer : renderer.generic.Renderer(renderer.Metal)
- libxev : kqueue
Update:
I'm not sure if this is related but this happened twice in a row for me, which is weird. (that t)
Yes, the windows terminals calculate Unicode width differently and not complete to the standard as well, like tmux. Proper Unicode support is lacking in many implementations unfortunately.
I saw some of it happening. Happens at wrapping break points, it might calculate the byte offset for the chars wrong there. Similarly, for streaming content when the text is incomplete it might have bytes until the middle of a grapheme.
Ah sure, Windows native terminal is notorious for CJK users already :)
Hoever,I think I could reliably reproduce grapheme error, with or without chunk streaming.
For example:
알겠습니다. Task 에이전트에 ktlint + detekt 검사를 위임하겠습니다.
This rendering issue persists regardless of being streamed or not.
This is another screenshot of the same session loaded without tmux: (opencode --continue)
The root cause seems to be char_offset vs col_offset mismatch in word wrap boundary detection. CJK characters have display width 2, but the code was using character count (width 1) for wrap calculations.
Activity
[-]fix(solid): CJK char corruption in text rendering[/-][+]fix: CJK char corruption in text rendering[/+]kommander commentedon Nov 3, 2025
Thanks for looking into this. I think the root cause for something like this would rather be in the renderer.zig for the ansi output, or width calculations in utf8.zig. Setting a default background prevents text from ever being rendered on transparent terminal background.
fix: skip rendering continuation cells to fix CJK character corruption
fix: ensure cursor position sync after rendering wide characters
fix: CJK character corruption by fixing wide character rendering and …
kommander commentedon Nov 3, 2025
I can't seem to be able to reproduce that. What terminal are you using?
zenyr commentedon Nov 4, 2025
Oh, okay. I'll attach my system configuration here:
I also found this issue on
Windows 11 Powershell / CMDenvironment too.I've made a tangent PR (adding React test suite with skipped tests) on #262.
Update:
t)[-]fix: CJK char corruption in text rendering[/-][+]bug: CJK char corruption in text rendering[/+]kommander commentedon Nov 4, 2025
Ahh tmux might be the culprit, it has some Unicode quirks, will try to reproduce.
The issue with the overlapping "t" is a different one, that needs flexShrink=0 and is handled in an issue on opencode.
zenyr commentedon Nov 5, 2025
Hmm while I do agree with the reasoning I could 100% reproduce this on my
Windows 11 device, which does not have any tmux related stuff available.kommander commentedon Nov 5, 2025
Yes, the windows terminals calculate Unicode width differently and not complete to the standard as well, like tmux. Proper Unicode support is lacking in many implementations unfortunately.
kommander commentedon Nov 6, 2025
zenyr commentedon Nov 6, 2025
Ah sure, Windows native terminal is notorious for CJK users already :)
Hoever,I think I could reliably reproduce grapheme error, with or without chunk streaming.
For example:
This rendering issue persists regardless of being streamed or not.
This is another screenshot of the same session loaded
without tmux: (opencode --continue)12 remaining items
kommander commentedon Nov 18, 2025
Alright, let's do this again, I'll get it right at some point. So many edge cases.
kommander commentedon Dec 10, 2025
I haven't forgotten about this, just didn't get through to it yet.
fix multibyte char split in wrapping logic (#307)
fix word wrapping with CJK and at wrap/chunk boundaries (#319)
kskang commentedon Jan 11, 2026
I created a PR that may fix this issue: #512
The root cause seems to be
char_offsetvscol_offsetmismatch in word wrap boundary detection. CJK characters have display width 2, but the code was using character count (width 1) for wrap calculations.Would appreciate if someone could test this fix.
kommander commentedon Jan 18, 2026
This should be better now?
zenyr commentedon Jan 20, 2026
https://opncd.ai/share/73TBWAXf (Last message contains a summary)
It's MUCH MUCH better now, the only edge case that I found was the Keycap emojis, which Haiku 4.5 often uses.
Other than that I think... it's fixed!
zenyr commentedon Jan 20, 2026
Thanks for fixing up the majority of issues. Please refer to the shared session above for the remaining edge cases. @kommander
fix(core): use byte offset for line_starts in text wrap
fix(core): use byte offset for line_starts in text wrap
fix(core): use byte offset for line_starts in text wrap
test(core): add no-wrap byte offset test for CJK text
fix(core): use byte offset for line_starts in no-wrap mode
perf(core): store byte_start/byte_len in VirtualChunk