--- a/ListView.st Wed Apr 02 17:32:39 1997 +0200
+++ b/ListView.st Thu Apr 03 00:01:04 1997 +0200
@@ -3277,59 +3277,57 @@
patternSize := pattern size.
(list notNil and:[patternSize ~~ 0]) ifTrue:[
- self withCursor:Cursor questionMark do:[
-"/ searchPattern := pattern.
- col := startCol - 1.
- firstChar := pattern at:1.
- col > (list at:startLine) size ifTrue:[
- col := -999
- ].
- line1 := startLine.
- line1 to:1 by:-1 do:[:lnr |
- lineString := list at:lnr.
- lineString notNil ifTrue:[
- lineSize := lineString size.
- col == -999 ifTrue:[col := lineSize - patternSize + 1].
- [(col > 0) and:[(lineString at:col) ~= firstChar]] whileTrue:[
- col := col - 1
- ].
- [col > 0] whileTrue:[
- cc := col.
- found := true.
- 1 to:patternSize do:[:cnr |
- cc > lineSize ifTrue:[
- found := false
- ] ifFalse:[
- (pattern at:cnr) ~= (lineString at:cc) ifTrue:[
- found := false
- ]
- ].
- cc := cc + 1
- ].
- found ifTrue:[
- ^ block1 value:lnr value:col.
- ].
- col := col - 1.
- [(col > 0) and:[(lineString at:col) ~= firstChar]] whileTrue:[
- col := col - 1
- ]
- ]
- ].
- col := -999.
- ]
- ]
+ self withCursor:Cursor questionMark do:[
+ col := startCol - 1.
+ firstChar := pattern at:1.
+ col > (list at:startLine) size ifTrue:[
+ col := -999
+ ].
+ line1 := startLine.
+ line1 to:1 by:-1 do:[:lnr |
+ lineString := list at:lnr.
+ lineString notNil ifTrue:[
+ lineSize := lineString size.
+ col == -999 ifTrue:[col := lineSize - patternSize + 1].
+ [(col > 0) and:[(lineString at:col) ~= firstChar]] whileTrue:[
+ col := col - 1
+ ].
+ [col > 0] whileTrue:[
+ cc := col.
+ found := true.
+ 1 to:patternSize do:[:cnr |
+ cc > lineSize ifTrue:[
+ found := false
+ ] ifFalse:[
+ (pattern at:cnr) ~= (lineString at:cc) ifTrue:[
+ found := false
+ ]
+ ].
+ cc := cc + 1
+ ].
+ found ifTrue:[
+ ^ block1 value:lnr value:col.
+ ].
+ col := col - 1.
+ [(col > 0) and:[(lineString at:col) ~= firstChar]] whileTrue:[
+ col := col - 1
+ ]
+ ]
+ ].
+ col := -999.
+ ]
+ ]
].
"not found"
^ block2 value
- "Modified: 26.2.1996 / 22:40:29 / cg"
+ "Modified: 3.4.1997 / 00:00:26 / cg"
!
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
"search for a pattern, if found evaluate block1 with row/col as arguments, if not
- found evaluate block2.
- Sorry, but pattern is no regular expression pattern (yet)"
+ found evaluate block2."
|lineString col patternSize
line1 "{Class: SmallInteger}"
@@ -3338,58 +3336,59 @@
patternSize := pattern size.
(list notNil and:[patternSize ~~ 0]) ifTrue:[
- self withCursor:Cursor questionMark do:[
-
- col := startCol + 1.
- line1 := startLine.
- line2 := list size.
-
- pattern includesMatchCharacters 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) ifTrue:[
- "/ ok, there it is; look at which position
- col := lineString findMatchString:realPattern startingAt:col ignoreCase:false ifAbsent:0.
- col ~~ 0 ifTrue:[
- ^ block1 value:lnr value:col.
- ]
- ].
- ].
- col := 1
- ]
- ] ifFalse:[
- line1 to:line2 do:[:lnr |
- lineString := list at:lnr.
- lineString isString ifTrue:[
- col := lineString findString:pattern 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) ifTrue:[
+ "/ ok, there it is; look at which position
+ col := lineString findMatchString:realPattern startingAt:col ignoreCase:false 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:[
+ col := lineString findString:p startingAt:col ifAbsent:0.
+ col ~~ 0 ifTrue:[
+ ^ block1 value:lnr value:col.
+ ]
+ ].
+ col := 1
+ ]
+ ].
+ ]
].
"not found"
^ block2 value
- "Modified: 26.2.1996 / 22:39:59 / cg"
+ "Modified: 2.4.1997 / 23:59:24 / cg"
! !
!ListView methodsFor:'tabulators'!
@@ -3586,5 +3585,5 @@
!ListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.127 1997-03-06 14:25:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.128 1997-04-02 22:01:04 cg Exp $'
! !