moveWordForward function
Implementation
int moveWordForward(
List<String> graphemes,
int offset, {
required GraphemePredicate isWord,
}) {
if (offset >= graphemes.length || graphemes.isEmpty) {
return graphemes.length;
}
var position = offset + 1;
while (position < graphemes.length && !isWord(graphemes[position])) {
position++;
}
while (position < graphemes.length && isWord(graphemes[position])) {
position++;
}
return position.clamp(0, graphemes.length);
}