--- a/ListView.st Fri Feb 23 18:06:53 1996 +0100
+++ b/ListView.st Fri Feb 23 19:13:53 1996 +0100
@@ -2499,52 +2499,54 @@
patternSize := pattern size.
(list notNil and:[patternSize ~~ 0]) ifTrue:[
- savedCursor := cursor.
- self cursor:(Cursor questionMark).
+ savedCursor := cursor.
+ self cursor:(Cursor questionMark).
"/ searchPattern := pattern.
- col := startCol - 1.
- firstChar := pattern at:1.
- col > (list at:startLine) size ifTrue:[
- col := nil
- ].
- line1 := startLine.
- line1 to:1 by:-1 do:[:lnr |
- lineString := list at:lnr.
- lineString notNil ifTrue:[
- col isNil ifTrue:[col := lineString size - 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 > lineString size ifTrue:[
- found := false
- ] ifFalse:[
- (pattern at:cnr) ~~ (lineString at:cc) ifTrue:[
- found := false
- ]
- ].
- cc := cc + 1
- ].
- found ifTrue:[
- self cursor:savedCursor.
- ^ block1 value:lnr value:col.
- ].
- col := col - 1.
- [(col > 0) and:[(lineString at:col) ~~ firstChar]] whileTrue:[
- col := col - 1
- ]
- ]
- ].
- col := nil
- ]
+ col := startCol - 1.
+ firstChar := pattern at:1.
+ col > (list at:startLine) size ifTrue:[
+ col := nil
+ ].
+ line1 := startLine.
+ line1 to:1 by:-1 do:[:lnr |
+ lineString := list at:lnr.
+ lineString notNil ifTrue:[
+ col isNil ifTrue:[col := lineString size - 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 > lineString size ifTrue:[
+ found := false
+ ] ifFalse:[
+ (pattern at:cnr) ~= (lineString at:cc) ifTrue:[
+ found := false
+ ]
+ ].
+ cc := cc + 1
+ ].
+ found ifTrue:[
+ self cursor:savedCursor.
+ ^ block1 value:lnr value:col.
+ ].
+ col := col - 1.
+ [(col > 0) and:[(lineString at:col) ~= firstChar]] whileTrue:[
+ col := col - 1
+ ]
+ ]
+ ].
+ col := nil
+ ]
].
"not found"
self cursor:savedCursor.
^ block2 value
+
+ "Modified: 23.2.1996 / 19:12:40 / cg"
!
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
@@ -2727,10 +2729,12 @@
nTabs := 1.
newLine := line copyFrom:9.
[newLine startsWith:eightSpaces] whileTrue:[
- newLine := newLine copyFrom:9.
- nTabs := nTabs + 1.
+ newLine := newLine copyFrom:9.
+ nTabs := nTabs + 1.
].
- ^ (String new:nTabs withAll:Character tab) asString , newLine.
+ ^ (line species new:nTabs withAll:Character tab) asString , newLine.
+
+ "Modified: 23.2.1996 / 19:10:36 / cg"
!
withTabs:tabulatorTable expand:line
@@ -2756,40 +2760,42 @@
nTabs == 0 ifTrue:[^ line].
currentMax := line size + (nTabs * 7).
- tmpString := String new:currentMax.
+ tmpString := line species new:currentMax.
dstIndex := 1.
line do:[:character |
- (character == (Character tab)) ifTrue:[
- nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
- [dstIndex < nextTab] whileTrue:[
- tmpString at:dstIndex put:(Character space).
- dstIndex := dstIndex + 1
- ]
- ] ifFalse:[
- tmpString at:dstIndex put:character.
- dstIndex := dstIndex + 1
- ].
- (dstIndex > currentMax) ifTrue:[
- "
- this cannot happen with <= 8 tabs
- "
- currentMax := currentMax + currentMax.
- nString := String new:currentMax.
- nString replaceFrom:1 to:(dstIndex - 1)
- with:tmpString startingAt:1.
- tmpString := nString.
- nString := nil
- ].
-
- "make stc-optimizer happy
- - no need to return value of ifTrue:/ifFalse above"
- 0
+ (character == (Character tab)) ifTrue:[
+ nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
+ [dstIndex < nextTab] whileTrue:[
+ tmpString at:dstIndex put:(Character space).
+ dstIndex := dstIndex + 1
+ ]
+ ] ifFalse:[
+ tmpString at:dstIndex put:character.
+ dstIndex := dstIndex + 1
+ ].
+ (dstIndex > currentMax) ifTrue:[
+ "
+ this cannot happen with <= 8 tabs
+ "
+ currentMax := currentMax + currentMax.
+ nString := line species new:currentMax.
+ nString replaceFrom:1 to:(dstIndex - 1)
+ with:tmpString startingAt:1.
+ tmpString := nString.
+ nString := nil
+ ].
+
+ "make stc-optimizer happy
+ - no need to return value of ifTrue:/ifFalse above"
+ 0
].
dstIndex := dstIndex - 1.
dstIndex == currentMax ifTrue:[
- ^ tmpString
+ ^ tmpString
].
^ tmpString copyTo:dstIndex
+
+ "Modified: 23.2.1996 / 19:11:01 / cg"
!
withTabsExpanded:line
@@ -2803,5 +2809,5 @@
!ListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.64 1996-02-23 02:25:52 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.65 1996-02-23 18:13:53 cg Exp $'
! !