TextCollector.st
changeset 5302 cb9b58fe53e9
parent 5301 3280021411a0
child 5303 18a31f81856f
equal deleted inserted replaced
5301:3280021411a0 5302:cb9b58fe53e9
   895 showCR:anObject
   895 showCR:anObject
   896     "insert the argument aString at current cursor position,
   896     "insert the argument aString at current cursor position,
   897      and advance to the next line. This is the same as a #show:
   897      and advance to the next line. This is the same as a #show:
   898      followed by a #cr."
   898      followed by a #cr."
   899 
   899 
   900     |printString lines|
   900     |printString lines crlf|
   901 
   901 
   902 "/ self ~~ Transcript ifTrue:[ ^ self tshow:anObject].
   902 "/ self ~~ Transcript ifTrue:[ ^ self tshow:anObject].
   903     printString := anObject printString.
   903     printString := anObject printString.
   904     printString size == 0 ifTrue:[
   904     printString size == 0 ifTrue:[
   905         self cr.
   905         self cr.
   919                 printString := self senderTraceString,': ',printString
   919                 printString := self senderTraceString,': ',printString
   920             ].
   920             ].
   921         ].
   921         ].
   922     ].
   922     ].
   923 
   923 
   924     (printString includesAny:(String crlf)) ifTrue:[
   924     crlf := String crlf.
       
   925     (printString includesAny:crlf) ifTrue:[
   925         lines := printString asStringCollection.
   926         lines := printString asStringCollection.
   926         lines do:[:line|
   927         lines do:[:line|
       
   928             |lineWithoutEOL|
       
   929 
   927             (line endsWith:Character nl) ifTrue:[
   930             (line endsWith:Character nl) ifTrue:[
   928                 (line endsWith:(String crlf)) ifTrue:[
   931                 (line endsWith:crlf) ifTrue:[
   929                     self addLine:(line copyButLast:2).
   932                     lineWithoutEOL := line copyButLast:2.
   930                 ] ifFalse:[
   933                 ] ifFalse:[
   931                     self addLine:(line copyButLast:1).
   934                     lineWithoutEOL := line copyButLast:1.
   932                 ]
   935                 ]
   933             ] ifFalse:[
   936             ] ifFalse:[
   934                 (line endsWith:Character return) ifTrue:[
   937                 (line endsWith:Character return) ifTrue:[
   935                     self addLine:(line copyButLast:1).
   938                     lineWithoutEOL := line copyButLast:1.
   936                 ] ifFalse:[
   939                 ] ifFalse:[
   937                     self addLine:line
   940                     lineWithoutEOL := line
   938                 ]
   941                 ]
   939             ]
   942             ].
       
   943             self addLine:lineWithoutEOL.
   940         ].
   944         ].
   941         ^ self.
   945         ^ self.
   942     ].
   946     ].
   943     self addLine:printString
   947     self addLine:printString
   944 
   948 
  1243 ! !
  1247 ! !
  1244 
  1248 
  1245 !TextCollector class methodsFor:'documentation'!
  1249 !TextCollector class methodsFor:'documentation'!
  1246 
  1250 
  1247 version
  1251 version
  1248     ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.141 2015-03-02 12:15:58 cg Exp $'
  1252     ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.142 2015-03-02 12:32:13 cg Exp $'
  1249 !
  1253 !
  1250 
  1254 
  1251 version_CVS
  1255 version_CVS
  1252     ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.141 2015-03-02 12:15:58 cg Exp $'
  1256     ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.142 2015-03-02 12:32:13 cg Exp $'
  1253 ! !
  1257 ! !
  1254 
  1258 
  1255 
  1259 
  1256 TextCollector initialize!
  1260 TextCollector initialize!