summaryrefslogtreecommitdiffstats
path: root/library/word.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/word.tcl')
-rw-r--r--library/word.tcl6
1 files changed, 4 insertions, 2 deletions
diff --git a/library/word.tcl b/library/word.tcl
index 0246530..0d66a32 100644
--- a/library/word.tcl
+++ b/library/word.tcl
@@ -136,7 +136,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]
}