Thai combining marks cause width miscalculation in modern terminals (Kitty, Ghostty)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 52/100
Direzione di ricerca
Start by inspecting the Thai ranges in _cell_widths.py, then run the supplied Console, Table, and cell_len reproduction with the listed Thai strings. Done means the reported Thai cell lengths match the terminal widths in Kitty and Ghostty, with table columns no longer misaligned.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Thai combining marks (vowels and tone marks) are marked as zero-width in CELL_WIDTHS, following Unicode's Mn (Nonspacing Mark) classification. However, modern terminal emulators (tested: Kitty, Ghostty) render Thai text with these characters taking visible width, causing table columns and other layouts to misalign.
Reproduction
from rich.console import Console
from rich.table import Table
from rich.cells import cell_len
console = Console()
table = Table(title='Thai Text Width Test')
table.add_column('Text', width=10)
table.add_column('cell_len')
for text in ['สวัสดี', 'น้ำ', 'กรุงเทพ']:
table.add_row(text, str(cell_len(text)))
console.print(table)
Width Analysis
| Text | Codepoints | Combining marks | Rich cell_len | Terminal width |
|---|---|---|---|---|
| สวัสดี | 6 | 2 | 4 | 6 |
| น้ำ | 3 | 1 | 2 | 3 |
| กรุงเทพ | 7 | 1 | 6 | 7 |
The discrepancy equals the number of combining marks — terminals render each Thai codepoint as width 1.
Affected Ranges in CELL_WIDTHS
| Range | Characters | Unicode Category |
|---|---|---|
| U+0E31 | ั | Mn (sara am vowel) |
| U+0E34-U+0E3A | ิ ี ึ ื ุ ู ฺ | Mn (vowel signs) |
| U+0E47-U+0E4E | ็ ่ ้ ๊ ๋ ์ ํ ๎ | Mn (tone marks) |
Environment
- Rich: 13.7.1
- Python: 3.14.2
- Terminals tested:
- Kitty 0.45.0 — affected
- Ghostty 1.2.3 — affected
- Platform: macOS
Proposed Fix
Change Thai combining mark ranges from width 0 to width 1 in _cell_widths.py. This matches actual terminal rendering behavior for Thai script.
- Lingua principale
- Python
- Stelle
- 57.6k
- Fork
- 2.4k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Textualize/rich
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Textualize/rich#4241 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
Textualize/rich#4240 ·
-
[BUG] Text.wrap(console, width=0) raises ValueError in chop_cells (range step 0)Forse di nuovo libera @UzairRehman4 l’ha presa 17 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
Textualize/rich#4234 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
Textualize/rich#4229 · 6 commenti ·
-
[BUG] Traceback rendering fails on ParseError with a non-string messageForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Textualize/rich#4225 · 4 commenti ·
Tutte le issue di Textualize/rich
Issue simili
-
Project submission:Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
slavakurilyak/awesome-ai-agents#845 ·
I maintainer di solito rispondono entro 1 giorno
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadifficulty:2 enhancement good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
MakazhanAlpamys/Soup#2178 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
scverse/rapids-singlecell#854 ·
I maintainer di solito rispondono entro 1 giorno
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLForse già presa @ninglinLiu l’ha presa oggi. Apertaarea:frontend backend:slang bug direction:input
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=FalseForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 13 giorni