'From Cuis 2.5 of 9 August 2010 [latest update: #534] on 9 August 2010 at 4:28:37 pm'!

!TextComposer methodsFor: 'as yet unclassified' stamp: 'jmv 8/3/2010 09:27'!
addEmptyTrailingLine
	"The line to add is always the first line of a new paragraph"
	| ts f h bs r lm rm w a leftMarginForAlignment s |
	s _ theText size+1.
	ts _ editor
		ifNotNil: [ editor lastParagraphStyle ]
		ifNil: [ theText textStyleAt: s].
	f _ editor
		ifNotNil: [ editor lastFont ]
		ifNil: [ theText fontAt: s ].

	h _ f height + ts paragraphSpacingBefore + ts paragraphSpacingAfter.
	bs _ f ascent + ts paragraphSpacingBefore.
	lm _ (ts isListStyle not
		ifTrue: [ts firstIndent]
		ifFalse: [ts restIndent]).
	rm _ ts rightIndent.
	w _ theContainer width.
	a _ ts alignment.
	leftMarginForAlignment _ a = CharacterScanner rightFlushCode
		ifTrue: [ w - rm]
		ifFalse: [
			a = CharacterScanner centeredCode
				ifTrue: [ (w - rm - lm) //2 + lm]
				ifFalse: [ lm ]].
	r _ theContainer left + leftMarginForAlignment @ currentY extent: 0@h.

	lines addLast: (
		EmptyLine new
			firstIndex: s lastIndex: s - 1;
			rectangle: r;
			lineHeight: h baseline: bs;
			textStyle: ts)! !

