Skip to content

fix: count Thai SARA AM clusters as two cells - #26

Open
SashaMIT wants to merge 1 commit into
clipperhouse:mainfrom
SashaMIT:fix/thai-sara-am
Open

SashaMIT wants to merge 1 commit into
clipperhouse:mainfrom
SashaMIT:fix/thai-sara-am

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 12, 2026 •

Copy link
Copy Markdown

Fixes #25.

A Thai consonant plus U+0E33 (SARA AM) is one grapheme. SARA AM decomposes to a non-spacing nikahit plus spacing SARA AA, so a terminal advances two cells. String looked at the leading consonant and returned 1. A lone SARA AM stays one cell.

Test plan

  • go test ./... -race -short
  • Removing the SARA AM check fails TestThaiSaraAmIsTwoCells (นำ, น้ำ, คำ, ค้ำ, and นำนำ).

A consonant plus U+0E33 is one grapheme, and that grapheme includes a spacing SARA AA. Terminals advance two cells. String returned 1.
@ossenthusiast

Copy link
Copy Markdown

Please note that this person might just be a bot whose using some sort of automation tool (agents) to mass-create PR on multiple different projects. I might be completely off here, so I apologize in advance if I am.

@SashaMIT

Copy link
Copy Markdown
Author

Fair to ask, and thanks for saying so carefully. I wrote this one because a Thai consonant plus SARA AM was counted as one cell, and I ran the width tests before opening it.

@ossenthusiast

Copy link
Copy Markdown

Fair to ask, and thanks for saying so carefully. I wrote this one because a Thai consonant plus SARA AM was counted as one cell, and I ran the width tests before opening it.

Looks like you are not then. I apologize.

@SashaMIT

Copy link
Copy Markdown
Author

No problem, I am using AI workflows and my code red system so I can understand your side too, but I'm real and actively working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thai grapheme clusters ending with SARA AM (U+0E33) should have a display width of 2 cells instead of 1

2 participants