diff options
-rw-r--r-- | library/word.tcl | 2 | ||||
-rw-r--r-- | tests/word.test | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/library/word.tcl b/library/word.tcl index 0c8e01c..a993918 100644 --- a/library/word.tcl +++ b/library/word.tcl @@ -147,7 +147,7 @@ proc tcl_startOfPreviousWord {str start} { variable ::tcl::WordBreakRE set word {-1 -1} if {$start > 0} { - regexp -indices -- $WordBreakRE(previous) [string range $str 0 $start-1] \ + regexp -indices -- $WordBreakRE(previous) [string range [string range $str 0 $start] 0 end-1] \ result word } return [lindex $word 0] diff --git a/tests/word.test b/tests/word.test index 453a635..c141aba 100644 --- a/tests/word.test +++ b/tests/word.test @@ -64,7 +64,7 @@ test word-2.6 {tcl_startOfPreviousWord} -body { test word-2.7 {tcl_startOfPreviousWord} -body { tcl_startOfPreviousWord "ab cd" end } -result 3 -test word-2.8 {tcl_startOfPreviousWord, bug [16e25e1402]} -constraints knownBug -body { +test word-2.8 {tcl_startOfPreviousWord, bug [16e25e1402]} -body { tcl_startOfPreviousWord "ab cd" end-1 } -result 0 |