summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/demos/entry3.tcl2
-rw-r--r--library/demos/items.tcl4
-rw-r--r--library/demos/ixset2
-rw-r--r--library/demos/knightstour.tcl8
-rw-r--r--library/fontchooser.tcl2
-rw-r--r--library/iconlist.tcl2
-rw-r--r--library/tearoff.tcl4
-rw-r--r--library/ttk/fonts.tcl2
-rw-r--r--tests/color.test2
-rw-r--r--tests/imgBmap.test4
-rw-r--r--tests/imgPhoto.test4
-rw-r--r--tests/textWind.test2
-rw-r--r--tests/tk.test2
-rw-r--r--tests/ttk/vsapi.test2
14 files changed, 21 insertions, 21 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 1370560..30fda5c 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 b2b3252..85664d9 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 35b40b6..a7acffa 100644
--- a/library/iconlist.tcl
+++ b/library/iconlist.tcl
@@ -705,7 +705,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/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 d819973..65f2c5e 100644
--- a/library/ttk/fonts.tcl
+++ b/library/ttk/fonts.tcl
@@ -78,7 +78,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 4f36b47..f885c59 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 35b6ddb..ba7966a 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -1495,8 +1495,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 fb3fcec..286964e 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 444c9a3..45690ce 100644
--- a/tests/tk.test
+++ b/tests/tk.test
@@ -159,7 +159,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 \