[FIX] Two cleanups for PositionableStream>>isEmpty

Andres Valloud avalloud at entrypoint.com
Thu Apr 6 21:51:32 UTC 2000


Hi.

Here are two cleanups for PositionableStream>>isEmpty. The changeset
also includes a warning in #isEmpty.

Andres.
-------------- next part --------------
'From Squeak2.6 of 11 October 1999 [latest update: #1578] on 6 April 2000 at 2:43:24 pm'!

!ParagraphEditor methodsFor: 'typing support' stamp: 'SqR!!!! 4/6/2000 14:39'!
insertTypeAhead: typeAhead

	typeAhead size = 0 ifFalse:
		[self zapSelectionWith: 
			(Text string: typeAhead contents emphasis: emphasisHere).
		typeAhead reset.
		startBlock _ stopBlock copy]! !


!PositionableStream methodsFor: 'testing' stamp: 'SqR!!!! 4/6/2000 14:34'!
isEmpty
	"Answer whether the receiver's contents has no elements."

	"This method is VERY MISLEADING and should not be used at all!!
	SqR!! 4/6/2000 14:34"

	^position = 0! !


!String methodsFor: 'converting' stamp: 'SqR!!!! 4/6/2000 14:41'!
keywords
	"Answer an array of the keywords that compose the receiver."
	| result aStream char |
	result _ WriteStream on: (Array new: 10).
	aStream _ WriteStream on: (String new: 16).
	1 to: self size do:
		[:i |
		aStream nextPut: (char _ self at: i).
		char = $: ifTrue: 
				[result nextPut: aStream contents.
				aStream reset]].

	"aStream isEmpty ifFalse: [result nextPut: aStream contents]."
	"Do not send #isEmpty, the method is extremely misleading!!
	SqR!! 4/6/2000 14:41"

	aStream size = 0 ifFalse: [result nextPut: aStream contents].
	^ result contents! !




More information about the Squeak-dev mailing list