mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 04:55:58 +03:00
[PR #256] [CLOSED] Fix CJK character corruption in text rendering #400
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#400
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?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/256
Author: @zenyr
Created: 11/3/2025
Status: ❌ Closed
Base:
main← Head:fix/cjk-character-corruption📝 Commits (2)
448dbfefix: cjk character corruption in text renderingd536896test: add fromString default color validation tests for CJK support📊 Changes
6 files changed (+568 additions, -1 deletions)
View changed files
📝
packages/core/src/renderables/TextNode.test.ts(+58 -0)📝
packages/core/src/renderables/TextNode.ts(+8 -1)➕
packages/core/src/tests/cjk-rendering.test.ts(+251 -0)📝
packages/react/src/index.ts(+1 -0)➕
packages/react/src/testing.ts(+37 -0)➕
packages/react/tests/cjk-unicode.test.tsx(+213 -0)📄 Description
Summary
This PR fixes the root cause of CJK character corruption (#255) by modifying the renderer to skip continuation cells instead of writing space placeholders.
Root Cause Analysis
CJK characters (width=2) occupy 2 terminal columns but are stored as 1 cell in the buffer. The original implementation had a fundamental issue:
Changes in Latest Commit
renderer.zig (6449abb):
TextNode.ts (6449abb):
fromString()TextNode.test.ts (6449abb):
Previous Changes (
448dbfe,d536896)Testing
✅ UTF-8 width calculation: CJK width correctly calculated as 2
✅ CJK rendering: All existing CJK tests pass
✅ Full test suite: 1957 pass, 0 fail
Impact
This is a radical fix that addresses the actual renderer bug rather than masking symptoms with forced colors. The approach:
Fixes #255
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.