TextView.st
changeset 2000 efdedcb4ee33
parent 1987 599825bed176
child 2024 3858c39a7eda
equal deleted inserted replaced
1999:7042cec087eb 2000:efdedcb4ee33
  1517      leading spaces will be replaced by tab-characters in the output."
  1517      leading spaces will be replaced by tab-characters in the output."
  1518 
  1518 
  1519     |startNr nLines string|
  1519     |startNr nLines string|
  1520 
  1520 
  1521     aStream isFileStream ifTrue:[
  1521     aStream isFileStream ifTrue:[
  1522 	"on some systems, writing linewise is very slow (via NFS)
  1522         "on some systems, writing linewise is very slow (via NFS)
  1523 	 therefore we convert to a string and write it in big chunks.
  1523          therefore we convert to a string and write it in big chunks.
  1524 	 To avoid creating huge strings, we do it in blocks of 1000 lines,
  1524          To avoid creating huge strings, we do it in blocks of 1000 lines,
  1525 	 limiting temporary string creation to about 50-80k.
  1525          limiting temporary string creation to about 50-80k.
  1526 	"
  1526         "
  1527 	startNr := 1.
  1527         startNr := 1.
  1528 	nLines := list size.
  1528         nLines := list size.
  1529 	[startNr <= nLines] whileTrue:[
  1529         [startNr <= nLines] whileTrue:[
  1530 	    string := list asStringWithCRsFrom:startNr 
  1530             string := list asStringWithCRsFrom:startNr 
  1531 					    to:((startNr + 1000) min:nLines)
  1531                                             to:((startNr + 1000) min:nLines)
  1532 				  compressTabs:compressTabs.
  1532                                   compressTabs:compressTabs.
  1533 	    encodingSymOrNil notNil ifTrue:[
  1533             encodingSymOrNil notNil ifTrue:[
  1534 		string := string encodeInto:encodingSymOrNil
  1534                 string := string encodeInto:encodingSymOrNil
  1535 	    ].
  1535             ].
  1536 	    aStream nextPutAll:string.
  1536             aStream nextPutAll:string.
  1537 	    startNr := startNr + 1000 + 1.
  1537             startNr := startNr + 1000 + 1.
  1538 	].
  1538         ].
  1539     ] ifFalse:[
  1539     ] ifFalse:[
  1540 	list do:[:aLine |
  1540         list do:[:aLine |
  1541 	    aLine notNil ifTrue:[
  1541             aLine notNil ifTrue:[
  1542 		encodingSymOrNil notNil ifTrue:[
  1542                 encodingSymOrNil notNil ifTrue:[
  1543 		    aStream nextPutLine:(aLine encodeInto:encodingSymOrNil)
  1543                     aStream nextPutLine:(aLine encodeInto:encodingSymOrNil)
  1544 		] ifFalse:[
  1544                 ] ifFalse:[
  1545 		    aStream nextPutLine:aLine.
  1545                     aStream nextPutLine:aLine.
  1546 		]
  1546                 ]
  1547 	    ].
  1547             ] ifFalse:[
  1548 	]
  1548                 aStream cr.
       
  1549             ]
       
  1550         ]
  1549     ]
  1551     ]
  1550 
  1552 
  1551     "Modified: 8.6.1996 / 11:50:46 / cg"
  1553     "Modified: 8.6.1996 / 11:50:46 / cg"
  1552 !
  1554 !
  1553 
  1555 
  2951 ! !
  2953 ! !
  2952 
  2954 
  2953 !TextView class methodsFor:'documentation'!
  2955 !TextView class methodsFor:'documentation'!
  2954 
  2956 
  2955 version
  2957 version
  2956     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.140 1999-08-18 14:31:38 cg Exp $'
  2958     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.141 1999-08-25 16:07:44 cg Exp $'
  2957 ! !
  2959 ! !