From 19dc5064c85b39f476591b65166c7ab4e80003d5 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Thu, 31 Oct 2024 17:54:45 -0400 Subject: [PATCH] Made conditions for word boundary a little more relaxed --- misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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