diff options
-rw-r--r-- | library/demos/entry3.tcl | 2 | ||||
-rw-r--r-- | library/demos/items.tcl | 4 | ||||
-rw-r--r-- | library/demos/ixset | 2 | ||||
-rw-r--r-- | library/demos/knightstour.tcl | 8 | ||||
-rw-r--r-- | library/fontchooser.tcl | 2 | ||||
-rw-r--r-- | library/iconlist.tcl | 2 | ||||
-rw-r--r-- | library/spinbox.tcl | 4 | ||||
-rw-r--r-- | library/tearoff.tcl | 4 | ||||
-rw-r--r-- | library/ttk/fonts.tcl | 2 | ||||
-rw-r--r-- | tests/color.test | 2 | ||||
-rw-r--r-- | tests/imgBmap.test | 4 | ||||
-rw-r--r-- | tests/imgPhoto.test | 4 | ||||
-rw-r--r-- | tests/textWind.test | 2 | ||||
-rw-r--r-- | tests/tk.test | 2 | ||||
-rw-r--r-- | tests/ttk/vsapi.test | 2 |
15 files changed, 23 insertions, 23 deletions
diff --git a/library/demos/entry3.tcl b/library/demos/entry3.tcl index d4435c6..acde1b3 100644 --- a/library/demos/entry3.tcl +++ b/library/demos/entry3.tcl @@ -102,7 +102,7 @@ foreach {chars digit} {abc 2 def 3 ghi 4 jkl 5 mno 6 pqrs 7 tuv 8 wxyz 9} { proc validatePhoneChange {W vmode idx char} { global phoneNumberMap entry3content - if {$idx == -1} {return 1} + if {$idx < 0} {return 1} after idle [list $W configure -validate $vmode -invcmd bell] if { !($idx<3 || $idx==6 || $idx==7 || $idx==11 || $idx>15) && diff --git a/library/demos/items.tcl b/library/demos/items.tcl index be9214a..c3e14c1 100644 --- a/library/demos/items.tcl +++ b/library/demos/items.tcl @@ -250,14 +250,14 @@ proc itemsUnderArea {c} { set area [$c find withtag area] set items "" foreach i [$c find enclosed $areaX1 $areaY1 $areaX2 $areaY2] { - if {[lsearch [$c gettags $i] item] != -1} { + if {[lsearch [$c gettags $i] item] >= 0} { lappend items $i } } puts stdout "Items enclosed by area: $items" set items "" foreach i [$c find overlapping $areaX1 $areaY1 $areaX2 $areaY2] { - if {[lsearch [$c gettags $i] item] != -1} { + if {[lsearch [$c gettags $i] item] >= 0} { lappend items $i } } diff --git a/library/demos/ixset b/library/demos/ixset index 13235de..7cc35aa 100644 --- a/library/demos/ixset +++ b/library/demos/ixset @@ -54,7 +54,7 @@ proc readsettings {} { global screencyc ; set screencyc 600 set xfd [open "|xset q" r] - while {[gets $xfd line] > -1} { + while {[gets $xfd line] >= 0} { switch -- [lindex $line 0] { auto { set rpt [lindex $line 1] diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl index b5cffa8..20e3d04 100644 --- a/library/demos/knightstour.tcl +++ b/library/demos/knightstour.tcl @@ -29,7 +29,7 @@ proc ValidMoves {square} { foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} { set col [expr {($square % 8) + [lindex $pair 0]}] set row [expr {($square / 8) + [lindex $pair 1]}] - if {$row > -1 && $row < 8 && $col > -1 && $col < 8} { + if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} { lappend moves [expr {$row * 8 + $col}] } } @@ -41,7 +41,7 @@ proc CheckSquare {square} { variable visited set moves 0 foreach test [ValidMoves $square] { - if {[lsearch -exact -integer $visited $test] == -1} { + if {[lsearch -exact -integer $visited $test] < 0} { incr moves } } @@ -55,7 +55,7 @@ proc Next {square} { set minimum 9 set nextSquare -1 foreach testSquare [ValidMoves $square] { - if {[lsearch -exact -integer $visited $testSquare] == -1} { + if {[lsearch -exact -integer $visited $testSquare] < 0} { set count [CheckSquare $testSquare] if {$count < $minimum} { set minimum $count @@ -190,7 +190,7 @@ proc CreateGUI {} { ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg] ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg] set square 0 - for {set row 7} {$row != -1} {incr row -1} { + for {set row 7} {$row >= 0} {incr row -1} { for {set col 0} {$col < 8} {incr col} { if {(($col & 1) ^ ($row & 1))} { set fill tan3 ; set dfill tan4 diff --git a/library/fontchooser.tcl b/library/fontchooser.tcl index 9197aea..a9bd706 100644 --- a/library/fontchooser.tcl +++ b/library/fontchooser.tcl @@ -384,7 +384,7 @@ proc ::tk::fontchooser::Tracer {var1 var2 op} { $S(W).l${var}s selection clear 0 end set n [lsearch -exact $S(${var}s,lcase) $value] $S(W).l${var}s selection set $n - if {$n != -1} { + if {$n >= 0} { set S($var) [lindex $S(${var}s) $n] $S(W).e$var icursor end $S(W).e$var selection clear diff --git a/library/iconlist.tcl b/library/iconlist.tcl index eed7476..369add0 100644 --- a/library/iconlist.tcl +++ b/library/iconlist.tcl @@ -697,7 +697,7 @@ package require Tk 8.6 } } - if {$theIndex > -1} { + if {$theIndex >= 0} { $w selection clear 0 end $w selection set $theIndex $w selection anchor $theIndex diff --git a/library/spinbox.tcl b/library/spinbox.tcl index f5a2ad3..2b387d2 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -483,10 +483,10 @@ proc ::tk::spinbox::MouseSelect {w x {cursor {}}} { word { if {$cur < [$w index anchor]} { set before [tcl_wordBreakBefore [$w get] $cur] - set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]] + set after [tcl_wordBreakAfter [$w get] $anchor-1] } else { set before [tcl_wordBreakBefore [$w get] $anchor] - set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]] + set after [tcl_wordBreakAfter [$w get] $cur-1] } if {$before < 0} { set before 0 diff --git a/library/tearoff.tcl b/library/tearoff.tcl index 4c8b404..dece4df 100644 --- a/library/tearoff.tcl +++ b/library/tearoff.tcl @@ -153,7 +153,7 @@ proc ::tk::MenuDup {src dst type} { # Copy tags to x, replacing each substring of src with dst. - while {[set index [string first $src $tags]] != -1} { + while {[set index [string first $src $tags]] >= 0} { if {$index > 0} { append x [string range $tags 0 $index-1]$dst } @@ -170,7 +170,7 @@ proc ::tk::MenuDup {src dst type} { # Copy script to x, replacing each substring of event with dst. - while {[set index [string first $event $script]] != -1} { + while {[set index [string first $event $script]] >= 0} { if {$index > 0} { append x [string range $script 0 $index-1] } diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl index a2781c6..bf4ccd0 100644 --- a/library/ttk/fonts.tcl +++ b/library/ttk/fonts.tcl @@ -82,7 +82,7 @@ switch -- [tk windowingsystem] { set F(family) "MS Sans Serif" } } else { - if {[lsearch -exact [font families] Tahoma] != -1} { + if {[lsearch -exact [font families] Tahoma] >= 0} { set F(family) "Tahoma" } else { set F(family) "MS Sans Serif" diff --git a/tests/color.test b/tests/color.test index 4cdaf23..2fd09d2 100644 --- a/tests/color.test +++ b/tests/color.test @@ -162,7 +162,7 @@ test color-1.4 {Tk_AllocColorFromObj - try other colors in list} colorsFree { test color-1.5 {Color table} nonPortable { set fd [open ../xlib/rgb.txt] set result {} - while {[gets $fd line] != -1} { + while {[gets $fd line] >= 0} { if {[string index $line 0] == "!"} continue set rgb [c255 [winfo rgb . [lrange $line 3 end]]] if {$rgb != [lrange $line 0 2] } { diff --git a/tests/imgBmap.test b/tests/imgBmap.test index a2ebdfa..8da1742 100644 --- a/tests/imgBmap.test +++ b/tests/imgBmap.test @@ -503,8 +503,8 @@ test imageBmap-11.2 {ImgBmapDelete procedure} -body { test imageBmap-12.1 {ImgBmapCmdDeletedProc procedure} -body { image create bitmap i2 -file foo.bm -maskfile foo2.bm rename i2 {} - list [lsearch -exact [imageNames] i2] [catch {i2 foo} msg] $msg -} -result {-1 1 {invalid command name "i2"}} + list [expr {i2 in [imageNames]}] [catch {i2 foo} msg] $msg +} -result {0 1 {invalid command name "i2"}} removeFile foo.bm removeFile foo2.bm diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test index 3c4c7a5..7767690 100644 --- a/tests/imgPhoto.test +++ b/tests/imgPhoto.test @@ -952,8 +952,8 @@ test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints { } -body { image create photo photo2 -file $teapotPhotoFile rename photo2 {} - list [lsearch -exact [imageNames] photo2] [catch {photo2 foo} msg] $msg -} -result {-1 1 {invalid command name "photo2"}} + list [expr {photo2 in [imageNames]}] [catch {photo2 foo} msg] $msg +} -result {0 1 {invalid command name "photo2"}} test imgPhoto-10.1 {Tk_ImgPhotoPutBlock procedure} -setup { imageCleanup diff --git a/tests/textWind.test b/tests/textWind.test index db75c68..f2b5703 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -773,7 +773,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup .t delete 1.0 end proc bgerror args { global msg - if {[lsearch -exact $msg $args] == -1} { + if {[lsearch -exact $msg $args] < 0} { lappend msg $args } } diff --git a/tests/tk.test b/tests/tk.test index 748a6cf..30a36d9 100644 --- a/tests/tk.test +++ b/tests/tk.test @@ -157,7 +157,7 @@ test tk-6.5 {tk inactive} -body { update after 100 set i [tk inactive] - expr {$i == -1 || ( $i > 90 && $i < 200 )} + expr {$i < 0 || ( $i > 90 && $i < 200 )} } -result 1 test tk-7.1 {tk inactive in a safe interpreter} -body { diff --git a/tests/ttk/vsapi.test b/tests/ttk/vsapi.test index bb88fef..3966bd9 100644 --- a/tests/ttk/vsapi.test +++ b/tests/ttk/vsapi.test @@ -6,7 +6,7 @@ package require tcltest ; namespace import -force tcltest::* loadTestedCommands testConstraint xpnative \ - [expr {[lsearch -exact [ttk::style theme names] xpnative] != -1}] + [expr {"xpnative" in [ttk::style theme names]}] test vsapi-1.1 "WINDOW WP_SMALLCLOSEBUTTON" -constraints {xpnative} -body { ttk::style element create smallclose vsapi \ |