diff --git a/misc.go b/misc.go index 31a3cfb..f8a6953 100644 --- a/misc.go +++ b/misc.go @@ -24,7 +24,7 @@ func dotChars() []rune { // Returns all possible characters represented by the d // Returns true if str[idx] and str[idx-1] are separated by a word boundary. func isWordBoundary(str []rune, idx int) bool { wbounded := idx == 0 || - idx == len(str)-1 || + idx >= len(str)-1 || (!slices.Contains(wordChars, str[idx-1]) && slices.Contains(wordChars, str[idx])) || (slices.Contains(wordChars, str[idx-1]) && !slices.Contains(wordChars, str[idx])) return wbounded