summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-01-27 22:40:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-01-27 22:40:22 (GMT)
commit748f5f9a656f5a308c1296c9217e47cb4fbe9db7 (patch)
tree8cf28df74b032c285a641829c31a2a9c4e2b76c6
parenteab419553e320a6f5e3c4cbf071193859ab3065a (diff)
downloadtk-748f5f9a656f5a308c1296c9217e47cb4fbe9db7.zip
tk-748f5f9a656f5a308c1296c9217e47cb4fbe9db7.tar.gz
tk-748f5f9a656f5a308c1296c9217e47cb4fbe9db7.tar.bz2
Simplify some TIP #621 procs, since it's Tcl counterparts can (now) handle indices like "end-1"
-rw-r--r--library/tk.tcl14
-rw-r--r--tests/cluster.test2
2 files changed, 1 insertions, 15 deletions
diff --git a/library/tk.tcl b/library/tk.tcl
index ca58b6f..a9db88c 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -744,8 +744,6 @@ if {[info commands ::tk::startOfNextWord] eq ""} {
proc ::tk::startOfNextWord {str start {locale {}}} {
if {$start < 0} {
set start -1
- } elseif {[string match end-* $start]} {
- set start [expr {[string length $str]-1-[string range $start 4 end]}]
}
set start [tcl_startOfNextWord $str $start]
if {$start < 0} {
@@ -758,8 +756,6 @@ if {[info commands ::tk::startOfPreviousWord] eq ""} {
proc ::tk::startOfPreviousWord {str start {locale {}}} {
if {$start < 0} {
set start -1
- } elseif {[string match end-* $start]} {
- set start [expr {[string length $str]-1-[string range $start 4 end]}]
}
set start [tcl_startOfPreviousWord $str $start]
if {$start < 0} {
@@ -772,8 +768,6 @@ if {[info commands ::tk::wordBreakBefore] eq ""} {
proc ::tk::wordBreakBefore {str start {locale {}}} {
if {$start < 0} {
set start -1
- } elseif {[string match end-* $start]} {
- set start [expr {[string length $str]-1-[string range $start 4 end]}]
}
set start [tcl_wordBreakBefore $str $start]
if {$start < 0} {
@@ -786,8 +780,6 @@ if {[info commands ::tk::wordBreakAfter] eq ""} {
proc ::tk::wordBreakAfter {str start {locale {}}} {
if {$start < 0} {
set start -1
- } elseif {[string match end-* $start]} {
- set start [expr {[string length $str]-1-[string range $start 4 end]}]
}
set start [tcl_wordBreakAfter $str $start]
if {$start < 0} {
@@ -807,9 +799,6 @@ if {[info commands ::tk::endOfCluster] eq ""} {
} elseif {$start >= [string length $str]} {
return ""
}
- if {[string length [string index $str $start]] > 1} {
- incr start
- }
incr start
return $start
}
@@ -825,9 +814,6 @@ if {[info commands ::tk::startOfCluster] eq ""} {
} elseif {$start >= [string length $str]} {
return [string length $str]
}
- if {[string length [string index $str $start]] < 1} {
- incr start -1
- }
if {$start < 0} {
return ""
}
diff --git a/tests/cluster.test b/tests/cluster.test
index 724283a..998759e 100644
--- a/tests/cluster.test
+++ b/tests/cluster.test
@@ -122,7 +122,7 @@ test cluster-4.7 {::tk::startOfPreviousWord} -body {
test cluster-4.8 {::tk::startOfPreviousWord} -body {
::tk::startOfPreviousWord "ab cd" {}
} -result {}
-test cluster-4.9 {::tk::startOfPreviousWord} -body {
+test cluster-4.9 {::tk::startOfPreviousWord} -constraints needsTcl87 -body {
::tk::startOfPreviousWord "ab cd" end-1
} -result 0