Skip to content

fix(doc):incorrect counting of non-ASCII characters in documentation - #64

Merged
pierreneter merged 2 commits into
p10node:mainfrom
barble:main
Dec 4, 2026
Merged

pierreneter merged 2 commits into
p10node:mainfrom
barble:main

Conversation

@barble

@barble barble commented Dec 4, 2026

Copy link
Copy Markdown
Contributor
image The Chinese word-counting logic contains errors. The original code counts by splitting text on spaces, an approach suited for English but incompatible with the conventions of other languages.

barble and others added 2 commits December 4, 2026 10:15
@pierreneter
pierreneter merged commit 439b26a into p10node:main Dec 4, 2026
2 checks passed
@pierreneter

Copy link
Copy Markdown
Member

Merged. Thank you, @barble, and thanks for the screenshot: it made the problem clear at once.

Word counts each Han character and each kana as one word, and countWords now does the same, while text in other scripts is counted as it was. I checked a few more cases against it (kana with the long vowel mark, Hangul, full-width Latin, characters outside the BMP) and they all come out as Word counts them. On a document of three million characters the count takes about 140 ms, so the status bar is not held up.

Nothing to fix on your side.

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.

2 participants