File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ function getGraphemeProblems(
85
85
cc : CharacterClass ,
86
86
flags : ReadonlyFlags ,
87
87
) : GraphemeProblem [ ] {
88
- let offset = cc . negate ? 2 : 1
88
+ const offset = cc . negate ? 2 : 1
89
89
90
90
const ignoreElements = cc . elements . filter (
91
91
( element ) =>
@@ -96,10 +96,12 @@ function getGraphemeProblems(
96
96
97
97
const problems : GraphemeProblem [ ] = [ ]
98
98
99
- for ( const { segment } of segmenter . segment ( cc . raw . slice ( offset , - 1 ) ) ) {
99
+ for ( const { segment, index } of segmenter . segment (
100
+ cc . raw . slice ( offset , - 1 ) ,
101
+ ) ) {
100
102
const problem = getProblem ( segment , flags )
101
103
if ( problem !== null ) {
102
- const start = offset + cc . start
104
+ const start = offset + index + cc . start
103
105
const end = start + segment . length
104
106
105
107
if (
@@ -120,7 +122,6 @@ function getGraphemeProblems(
120
122
) ,
121
123
} )
122
124
}
123
- offset += segment . length
124
125
}
125
126
126
127
return problems
You can’t perform that action at this time.
0 commit comments