Skip to content

Commit 12dc573

Browse files
authored
reset consonant state on boundary emit (#128)
* fix consonant cluster breaks with spaces * changeset
1 parent f5d3453 commit 12dc573

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎.changeset/heavy-clouds-walk.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
"unicode-segmenter": patch
3+
---
4+
5+
Fix GB9c rule; reset internal "InCB=Consonant" state properly.
6+
7+
So giving the following input:
8+
9+
```
10+
# Malayalam KA + Virama + SPACE + VA
11+
"क्‌ क"
12+
```
13+
14+
Will now produces three sperated segments correctly.
15+
16+
Thanks to @spaceemotion for reporting this issue.

‎src/grapheme.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export function* graphemeSegments(input) {
150150

151151
// Reset segment state
152152
emoji = false;
153+
consonant = false;
153154
riCount = 0;
154155
index = cursor;
155156
_catBegin = catAfter;

‎test/grapheme.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ test('counterexamples', async t => {
307307
' जा',
308308
' କା',
309309
' ଶ୍ୟା',
310+
'ക് വ',
310311
];
311312

312313
for (let counter of counterExamples) {

0 commit comments

Comments
 (0)