'From Squeak3.1alpha of 5 February 2001 [latest update: #4068] on 24 May 2001 at 7:52:31 pm'! "Change Set: loopingParagraphs Date: 24 May 2001 Author: Bob Arning A strange synergy recently surfaced where linked TextMorphs could receive messages like #predecessorChanged before they had completed their initial composition. This update handles this successfully, if not elegantly, by ignoring #predecessorChanged while in this state."! !TextMorph methodsFor: 'private' stamp: 'RAA 5/24/2001 19:38'! paragraph "Paragraph instantiation is lazy -- create it only when needed" paragraph ifNotNil: [^ paragraph]. self setProperty: #CreatingParagraph toValue: true. self setDefaultContentsIfNil. "...Code here to recreate the paragraph..." paragraph _ (self paragraphClass new textOwner: self owner). paragraph wantsColumnBreaks: successor notNil. paragraph compose: text style: textStyle copy from: self startingIndex in: self container. wrapFlag ifFalse: ["Was given huge container at first... now adjust" paragraph adjustRightX]. self fit. self removeProperty: #CreatingParagraph. ^ paragraph! ! !TextMorph methodsFor: 'private' stamp: 'RAA 5/24/2001 19:38'! predecessorChanged | newStart oldStart | (self hasProperty: #CreatingParagraph) ifTrue: [^self]. newStart _ predecessor == nil ifTrue: [1] ifFalse: [predecessor lastCharacterIndex + 1]. (self paragraph adjustedFirstCharacterIndex ~= newStart or: [newStart >= text size]) ifTrue: [paragraph composeAllStartingAt: newStart. self fit] ifFalse: ["If the offset to end of text has not changed, just slide" oldStart _ self firstCharacterIndex. self withSuccessorsDo: [:m | m adjustLineIndicesBy: newStart - oldStart]]. ! !