diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-03-29 07:30:11 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-03-29 07:30:11 (GMT) |
commit | 3c3e58351a1441181863aa015487e10307e5d6de (patch) | |
tree | 3081e6ad1f8efc367bce61bcd8ee5caa9a3c65fd /library/tk.tcl | |
parent | 2937446e0ba89de3f5f4cd81d6758999b3722193 (diff) | |
parent | 287ae817d18f64049ec3b37a0d233fec9117ed94 (diff) | |
download | tk-3c3e58351a1441181863aa015487e10307e5d6de.zip tk-3c3e58351a1441181863aa015487e10307e5d6de.tar.gz tk-3c3e58351a1441181863aa015487e10307e5d6de.tar.bz2 |
Merge "enhanced-index" branch, so this TIP can make use of indices like "end-1"
Diffstat (limited to 'library/tk.tcl')
-rw-r--r-- | library/tk.tcl | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/library/tk.tcl b/library/tk.tcl index da388bd..5edafc2 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -703,17 +703,29 @@ if {[tk windowingsystem] eq "aqua"} { if {[info commands ::tk::endOfWord] eq ""} { proc ::tk::endOfWord {str start {locale {}}} { - return [tcl_endOfWord $str $start] + set start [tcl_endOfWord $str $start] + if {$start < 0} { + set start "" + } + return $start } } if {[info commands ::tk::startOfNextWord] eq ""} { proc ::tk::startOfNextWord {str start {locale {}}} { - return [tcl_startOfNextWord $str $start] + set start [tcl_startOfNextWord $str $start] + if {$start < 0} { + set start "" + } + return $start } } if {[info commands ::tk::startOfPreviousWord] eq ""} { proc ::tk::startOfPreviousWord {str start {locale {}}} { - return [tcl_startOfPreviousWord $str $start] + set start [tcl_startOfPreviousWord $str $start] + if {$start < 0} { + set start "" + } + return $start } } if {[info commands ::tk::endOfCluster] eq ""} { @@ -721,7 +733,7 @@ if {[info commands ::tk::endOfCluster] eq ""} { if {$start eq "end"} { return [string length $str] } elseif {$start >= [string length $str]} { - return -1 + return "" } if {[string length [string index $str $start]] > 1} { set start [expr {$start+1}] @@ -741,7 +753,7 @@ if {[info commands ::tk::startOfCluster] eq ""} { set start [expr {$start-1}] } if {$start < 0} { - return -1 + return "" } return $start } |