'From Squeak3.3alpha of 15 February 2002 [latest update: #4877] on 24 May 2002 at 7:54:45 pm'! "Change Set: PastEndPut-2-tk Date: 24 May 2002 Author: Ted Kaehler Fixes bug in PastEndPut-gh. A stream writing into a Text now calls replaceFrom:to:with:startingAt: instead of replaceFrom:to:with:. The inherited version does not handle the runs correctly. This fix tries to handle the runs. Example is that diffs in versions did not show any text changes in the first part of the text (before the place where the stream had to grow)."! !Text methodsFor: 'accessing' stamp: 'tk 5/24/2002 19:48'! replaceFrom: start to: stop with: replacement startingAt: repStart "This destructively replaces elements from start to stop in the receiver starting at index, repStart, in replacementCollection. Do it to both the string and the runs." | rep newRepRuns | rep _ replacement asText. "might be a string" string replaceFrom: start to: stop with: rep string startingAt: repStart. repStart = 1 ifTrue: [runs _ runs copyReplaceFrom: start to: stop with: rep runs] ifFalse: [newRepRuns _ rep runs copyFrom: repStart to: rep size. runs _ runs copyReplaceFrom: start to: stop with: newRepRuns]. ! !