summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-01-27 11:51:45 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-01-27 11:51:45 (GMT)
commit854b7843239099dbf9cbe6511b64f334da7cb066 (patch)
tree9622c2c14ecfc5d73bd73577892a54c90dd69cba
parentf50f3eca348c2e373a3e08e2a203bc9108f0fb29 (diff)
parent4700e9e59f18ee698abac1e482b1d12100a00df3 (diff)
downloadtcl-854b7843239099dbf9cbe6511b64f334da7cb066.zip
tcl-854b7843239099dbf9cbe6511b64f334da7cb066.tar.gz
tcl-854b7843239099dbf9cbe6511b64f334da7cb066.tar.bz2
Fix [16e25e1402]: tcl_startOfPreviousWord cannot handle "end-1"
-rw-r--r--library/word.tcl2
-rw-r--r--tests/word.test2
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