'From Squeak5.3alpha of 15 May 2019 [latest update: #18584] on 16 May 2019 at 10:13:01 am'!

!TranscriptStream methodsFor: 'stream extensions' stamp: 'mt 5/16/2019 10:10'!
show: anObject
	"TextCollector compatibility"
	
	[
		self hasAttributes
			ifFalse: [self nextPutAll: anObject asString]
			ifTrue: [self nextPut: anObject asStringOrText].
		self endEntry
	] on: FileWriteError do: [self class redirectToStdOut: false].! !

!TranscriptStream methodsFor: 'stream extensions' stamp: 'mt 5/16/2019 10:11'!
showln: anObject
	"TextCollector compatibility. Ensure a new line before inserting a message."
	
	[
		self hasAttributes
			ifFalse: [self cr; nextPutAll: anObject asString]
			ifTrue: [self cr; nextPut: anObject asStringOrText].
		self endEntry.
	] on: FileWriteError do: [self class redirectToStdOut: false].! !

!TranscriptStream methodsFor: 'accessing' stamp: 'mt 5/16/2019 10:10'!
contents
	"Override to update lastChar."
	position > 0 ifTrue:
		[lastChar := collection at: position].

	^ self hasAttributes ifFalse: [super contents] ifTrue: [		
		Text streamContents: [:s | super contents do: [:each |
			s nextPutAll: each asStringOrText]]]! !

!TranscriptStream methodsFor: 'accessing' stamp: 'mt 5/16/2019 10:09'!
hasAttributes

	^ collection isString not! !


!TranscriptStream class methodsFor: 'instance creation' stamp: 'mt 5/16/2019 10:07'!
new
	^ self on: (Array new: 1000)
"
INSTALLING:
TextCollector allInstances do:
	[:t | t breakDependents.
	t become: TranscriptStream new].

TESTING: (Execute this text in a workspace)
Do this first...
	tt := TranscriptStream new.
	tt openLabel: 'Transcript test 1'.
Then this will open a second view -- ooooh...
	tt openLabel: 'Transcript test 2'.
And finally make them do something...
	tt clear.
	[Sensor anyButtonPressed] whileFalse:
		[1 to: 20 do: [:i | tt print: (2 raisedTo: i-1); cr; endEntry]].
"! !

