Describe the bug
In the "Asian language support" demo section of Rich, Chinese/Japanese/Korean (CJK) text is misaligned with the leading Unicode symbols (C/J/K markers). The CJK text is horizontally offset, causing layout distortion and visual misalignment, which breaks the expected visual structure of the panel.
To Reproduce
Steps to reproduce the behavior:
- Run the following Python code with Rich:
from rich import print
from rich.panel import Panel
from rich.text import Text
# Replicate the Asian language support demo with layout issue
asian_text = Text()
asian_text.append("C ", style="bold magenta")
asian_text.append("该库支持中文,日文和韩文文本!\n", style="green")
asian_text.append("J ", style="bold magenta")
asian_text.append("ライブラリは中国語、日本語、韓国語のテキストをサポートしています\n", style="green")
asian_text.append("K ", style="bold magenta")
asian_text.append("이 라이브러리는 중국어, 일본어 및 한국어 텍스트를 지원합니다", style="green")
# Print panel (the core of the issue)
print(Panel(asian_text, title="Asian language support"))
Observe the output in the terminal: the CJK text is not aligned with the "C/J/K" markers, and the overall layout is distorted.
Expected behavior
The leading "C/J/K" symbols should be vertically aligned with the start of the corresponding CJK text lines.
CJK characters should be calculated with correct East Asian Width (double-width) to avoid layout offset.
No horizontal misalignment or visual distortion in the panel.
Screenshots
OS: Windows 11
Python version: 3.11.4
Rich version: 13.7.0 (or your installed version)
Terminal: Windows PowerShell
Describe the bug
In the "Asian language support" demo section of Rich, Chinese/Japanese/Korean (CJK) text is misaligned with the leading Unicode symbols (C/J/K markers). The CJK text is horizontally offset, causing layout distortion and visual misalignment, which breaks the expected visual structure of the panel.
To Reproduce
Steps to reproduce the behavior:
Observe the output in the terminal: the CJK text is not aligned with the "C/J/K" markers, and the overall layout is distorted.
Expected behavior
The leading "C/J/K" symbols should be vertically aligned with the start of the corresponding CJK text lines.
CJK characters should be calculated with correct East Asian Width (double-width) to avoid layout offset.
No horizontal misalignment or visual distortion in the panel.
Screenshots
OS: Windows 11
Python version: 3.11.4
Rich version: 13.7.0 (or your installed version)
Terminal: Windows PowerShell