changed: #withNoLineLongerThan:
authorClaus Gittinger <cg@exept.de>
Mon, 29 Oct 2012 12:55:18 +0100
changeset 14451 c06e7885b675
parent 14450 588ffd2a9757
child 14452 ef3591302afa
changed: #withNoLineLongerThan: | replaced by or:
CharacterArray.st
--- a/CharacterArray.st	Mon Oct 29 12:43:52 2012 +0100
+++ b/CharacterArray.st	Mon Oct 29 12:55:18 2012 +0100
@@ -1107,39 +1107,36 @@
 
     | listOfLines currentLast currentStart resultString putativeLast putativeLine crPosition |
 
-    aNumber isNumber not | (aNumber < 1) ifTrue: [self error: 'too narrow'].
+    (aNumber isNumber not or:[ aNumber < 1] ) ifTrue: [self error: 'too narrow'].
     listOfLines _ OrderedCollection new.
     currentLast _ 0.
     [currentLast < self size] whileTrue:
-	    [currentStart _ currentLast + 1.
-	    putativeLast _ (currentStart + aNumber - 1) min: self size.
-	    putativeLine _ self copyFrom: currentStart to: putativeLast.
-	    (crPosition _ putativeLine indexOf: Character cr) > 0 ifTrue:
-		    [putativeLast _ currentStart + crPosition - 1.
-		    putativeLine _ self copyFrom: currentStart to: putativeLast].
-	    currentLast _ putativeLast == self size
-		    ifTrue:
-			    [putativeLast]
-		    ifFalse:
-			    [currentStart + putativeLine lastSpacePosition - 1].
-	    currentLast <= currentStart ifTrue:
-		    ["line has NO spaces; baleout!!"
-		    currentLast _ putativeLast].
-	    listOfLines add: (self copyFrom: currentStart to: currentLast) withBlanksTrimmed].
+            [currentStart _ currentLast + 1.
+            putativeLast _ (currentStart + aNumber - 1) min: self size.
+            putativeLine _ self copyFrom: currentStart to: putativeLast.
+            (crPosition _ putativeLine indexOf: Character cr) > 0 ifTrue:
+                    [putativeLast _ currentStart + crPosition - 1.
+                    putativeLine _ self copyFrom: currentStart to: putativeLast].
+            currentLast _ putativeLast == self size
+                    ifTrue:
+                            [putativeLast]
+                    ifFalse:
+                            [currentStart + putativeLine lastSpacePosition - 1].
+            currentLast <= currentStart ifTrue:
+                    ["line has NO spaces; baleout!!"
+                    currentLast _ putativeLast].
+            listOfLines add: (self copyFrom: currentStart to: currentLast) withBlanksTrimmed].
 
     listOfLines size > 0 ifFalse: [^ ''].
     resultString _ listOfLines first.
     2 to: listOfLines size do:
-	    [:i | resultString _ resultString, Character cr asString, (listOfLines at: i)].
+            [:i | resultString _ resultString, Character cr asString, (listOfLines at: i)].
     ^ resultString
 
     "
      #(5 7 20) collect:
-	[:i | 'Fred the bear went down to the brook to read his book in silence' withNoLineLongerThan: i]
-    "
-
-
-
+        [:i | 'Fred the bear went down to the brook to read his book in silence' withNoLineLongerThan: i]
+    "
 !
 
 withSqueakLineEndings
@@ -6100,11 +6097,11 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.477 2012-10-23 12:59:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.478 2012-10-29 11:55:18 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.477 2012-10-23 12:59:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.478 2012-10-29 11:55:18 cg Exp $'
 ! !
 
 CharacterArray initialize!