TextCollector.st
changeset 1504 3101f410e230
parent 1500 dee7275372f1
child 1562 9b7557a81849
--- a/TextCollector.st	Thu Apr 23 10:11:25 1998 +0200
+++ b/TextCollector.st	Fri Apr 24 20:46:15 1998 +0200
@@ -13,7 +13,7 @@
 EditTextView subclass:#TextCollector
 	instanceVariableNames:'entryStream lineLimit destroyAction outstandingLines
 		outstandingLine flushBlock flushPending inFlush collecting
-		timeDelay access'
+		timeDelay access currentEmphasis'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-Text'
@@ -139,6 +139,11 @@
 
 deselect
     self unselect
+!
+
+flush
+    self endEntry.
+    super flush
 ! !
 
 !TextCollector methodsFor:'accessing'!
@@ -406,6 +411,10 @@
 
 !TextCollector methodsFor:'stream messages'!
 
+bold
+    currentEmphasis := #bold
+!
+
 cr
     "output a carriage return, finishing the current line"
 
@@ -443,6 +452,10 @@
      ^ entryStream perform:(aMessage selector) withArguments:(aMessage arguments)
 !
 
+italic
+    currentEmphasis := #italic
+!
+
 lineLength
     "to make a textCollector (somewhat) compatible with printer
      streams, support the lineLength query"
@@ -456,12 +469,19 @@
     "append somethings printString to my displayed text.
      This allows TextCollectors to be used Stream-wise"
 
+    |txt|
+
     (something isCharacter) ifTrue:[
         ((something == Character cr) or:[something == Character nl]) ifTrue:[
             ^ self cr
         ].
     ].
-    self show:(something asString).
+
+    txt := something asString.
+    currentEmphasis notNil ifTrue:[
+        txt := txt emphasizeAllWith:currentEmphasis
+    ].
+    self show:txt.
 
 "/    flushPending ifTrue:[
 "/        self endEntry
@@ -484,11 +504,18 @@
     "append all of something to my displayed text.
      This allows TextCollectors to be used Stream-wise"
 
+    currentEmphasis notNil ifTrue:[
+        ^ self show:(something emphasizeAllWith:currentEmphasis)
+    ].
     ^ self show:something
 
     "Modified: 11.1.1997 / 14:43:26 / cg"
 !
 
+normal
+    currentEmphasis := nil
+!
+
 show:anObject
     "insert the argument aString at current cursor position"
 
@@ -574,5 +601,5 @@
 !TextCollector class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.45 1998-04-22 15:11:30 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.46 1998-04-24 18:46:15 cg Exp $'
 ! !