class: TextCollector
authorClaus Gittinger <cg@exept.de>
Mon, 02 Mar 2015 13:32:13 +0100
changeset 5302 cb9b58fe53e9
parent 5301 3280021411a0
child 5303 18a31f81856f
class: TextCollector changed: #showCR:
TextCollector.st
--- a/TextCollector.st	Mon Mar 02 13:15:58 2015 +0100
+++ b/TextCollector.st	Mon Mar 02 13:32:13 2015 +0100
@@ -897,7 +897,7 @@
      and advance to the next line. This is the same as a #show:
      followed by a #cr."
 
-    |printString lines|
+    |printString lines crlf|
 
 "/ self ~~ Transcript ifTrue:[ ^ self tshow:anObject].
     printString := anObject printString.
@@ -921,22 +921,26 @@
         ].
     ].
 
-    (printString includesAny:(String crlf)) ifTrue:[
+    crlf := String crlf.
+    (printString includesAny:crlf) ifTrue:[
         lines := printString asStringCollection.
         lines do:[:line|
+            |lineWithoutEOL|
+
             (line endsWith:Character nl) ifTrue:[
-                (line endsWith:(String crlf)) ifTrue:[
-                    self addLine:(line copyButLast:2).
+                (line endsWith:crlf) ifTrue:[
+                    lineWithoutEOL := line copyButLast:2.
                 ] ifFalse:[
-                    self addLine:(line copyButLast:1).
+                    lineWithoutEOL := line copyButLast:1.
                 ]
             ] ifFalse:[
                 (line endsWith:Character return) ifTrue:[
-                    self addLine:(line copyButLast:1).
+                    lineWithoutEOL := line copyButLast:1.
                 ] ifFalse:[
-                    self addLine:line
+                    lineWithoutEOL := line
                 ]
-            ]
+            ].
+            self addLine:lineWithoutEOL.
         ].
         ^ self.
     ].
@@ -1245,11 +1249,11 @@
 !TextCollector class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.141 2015-03-02 12:15:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.142 2015-03-02 12:32:13 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.141 2015-03-02 12:15:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.142 2015-03-02 12:32:13 cg Exp $'
 ! !