searching with non-string items
authorMichael Beyl <mb@exept.de>
Tue, 23 Jul 2002 23:02:27 +0200
changeset 2562 bf1ac08c9de5
parent 2561 b4b64dd40018
child 2563 ffb88664908a
searching with non-string items
ListView.st
--- a/ListView.st	Tue Jul 23 22:51:52 2002 +0200
+++ b/ListView.st	Tue Jul 23 23:02:27 2002 +0200
@@ -4080,6 +4080,9 @@
             line1 to:1 by:-1 do:[:lnr |
                 lineString := list at:lnr.
                 lineString notNil ifTrue:[
+                    lineString := lineString asString
+                ].
+                lineString notNil ifTrue:[
                     lineSize := lineString size.
                     col == -999 ifTrue:[col := lineSize - patternSize + 1].
                     [(col > 0) 
@@ -4153,68 +4156,71 @@
 
     patternSize := pattern size.
     (list notNil and:[patternSize ~~ 0]) ifTrue:[
-	self withCursor:Cursor questionMark do:[
-
-	    col := startCol + 1.
-	    line1 := startLine.
-	    line2 := list size.
-
-	    pattern includesUnescapedMatchCharacters ifTrue:[
-		p := pattern species new:0.
-		(pattern startsWith:$*) ifFalse:[
-		    p := p , '*'
-		].
-		p := p , pattern.
-		(pattern endsWith:$*) ifFalse:[
-		    p := p , '*'
-		].
-		realPattern := pattern.
-		(realPattern startsWith:$*) ifTrue:[
-		    realPattern := realPattern copyFrom:2
-		].
-		line1 to:line2 do:[:lnr |
-		    lineString := list at:lnr.
-		    lineString notNil ifTrue:[
-			"/ first a crude check ...
-			(p match:lineString ignoreCase:ignCase) ifTrue:[
-			    "/ ok, there it is; look at which position
-			    col := lineString 
-					findMatchString:realPattern 
-					startingAt:col 
-					ignoreCase:ignCase 
-					ifAbsent:0.
-			    col ~~ 0 ifTrue:[
-				^ block1 value:lnr value:col.
-			    ]
-			].
-		    ].
-		    col := 1
-		]
-	    ] ifFalse:[
-		p := pattern withoutMatchEscapes.
-		line1 to:line2 do:[:lnr |
-		    lineString := list at:lnr.
-		    lineString isString ifTrue:[
-			ignCase ifTrue:[
-			    col := lineString 
-					findMatchString:p 
-					startingAt:col 
-					ignoreCase:ignCase 
-					ifAbsent:0.
-			] ifFalse:[
-			    col := lineString 
-					findString:p 
-					startingAt:col 
-					ifAbsent:0.
-			].
-			col ~~ 0 ifTrue:[
-			    ^ block1 value:lnr value:col.
-			]
-		    ].
-		    col := 1
-		]
-	    ].
-	]
+        self withCursor:Cursor questionMark do:[
+
+            col := startCol + 1.
+            line1 := startLine.
+            line2 := list size.
+
+            pattern includesUnescapedMatchCharacters ifTrue:[
+                p := pattern species new:0.
+                (pattern startsWith:$*) ifFalse:[
+                    p := p , '*'
+                ].
+                p := p , pattern.
+                (pattern endsWith:$*) ifFalse:[
+                    p := p , '*'
+                ].
+                realPattern := pattern.
+                (realPattern startsWith:$*) ifTrue:[
+                    realPattern := realPattern copyFrom:2
+                ].
+                line1 to:line2 do:[:lnr |
+                    lineString := list at:lnr.
+                    lineString notNil ifTrue:[
+                        "/ first a crude check ...
+                        (p match:lineString ignoreCase:ignCase) ifTrue:[
+                            "/ ok, there it is; look at which position
+                            col := lineString 
+                                        findMatchString:realPattern 
+                                        startingAt:col 
+                                        ignoreCase:ignCase 
+                                        ifAbsent:0.
+                            col ~~ 0 ifTrue:[
+                                ^ block1 value:lnr value:col.
+                            ]
+                        ].
+                    ].
+                    col := 1
+                ]
+            ] ifFalse:[
+                p := pattern withoutMatchEscapes.
+                line1 to:line2 do:[:lnr |
+                    lineString := list at:lnr.
+                    lineString notNil ifTrue:[
+                        lineString := lineString asString
+                    ].
+                    lineString isString ifTrue:[
+                        ignCase ifTrue:[
+                            col := lineString 
+                                        findMatchString:p 
+                                        startingAt:col 
+                                        ignoreCase:ignCase 
+                                        ifAbsent:0.
+                        ] ifFalse:[
+                            col := lineString 
+                                        findString:p 
+                                        startingAt:col 
+                                        ifAbsent:0.
+                        ].
+                        col ~~ 0 ifTrue:[
+                            ^ block1 value:lnr value:col.
+                        ]
+                    ].
+                    col := 1
+                ]
+            ].
+        ]
     ].
     "not found"
 
@@ -4438,5 +4444,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.267 2002-07-23 20:51:52 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.268 2002-07-23 21:02:27 mb Exp $'
 ! !