summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/word.tcl6
1 files changed, 4 insertions, 2 deletions
diff --git a/library/word.tcl b/library/word.tcl
index 3e4bc3a..4e57479 100644
--- a/library/word.tcl
+++ b/library/word.tcl
@@ -146,7 +146,9 @@ proc tcl_startOfNextWord {str start} {
proc tcl_startOfPreviousWord {str start} {
variable ::tcl::WordBreakRE
set word {-1 -1}
- regexp -indices -- $WordBreakRE(previous) [string range $str 0 $start-1] \
- result word
+ if {$start > 0} {
+ regexp -indices -- $WordBreakRE(previous) [string range $str 0 $start-1] \
+ result word
+ }
return [lindex $word 0]
}