Patrick Rein uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-pre.1192.mcz ==================== Summary ==================== Name: Morphic-pre.1192 Author: pre Time: 20 July 2016, 11:03:12.063382 pm UUID: bd2a03f6-120a-d543-af91-d4535051c547 Ancestors: Morphic-mt.1191 Removing code from the TextMorph which copied text attributes from the old content to the new content in certain cases. =============== Diff against Morphic-mt.1191 =============== Item was changed: ----- Method: TextMorph>>newContents: (in category 'accessing') ----- newContents: stringOrText "Accept new text contents." | newText embeddedMorphs oldSelection | "If my text is all the same font, use the font for my new contents" + newText := stringOrText isString + ifTrue: [Text fromString: stringOrText copy ] + ifFalse: [ stringOrText copy asText. "should be veryDeepCopy?" ]. - newText := stringOrText isString ifTrue: [ | textSize | - (text notNil - and: [ (textSize := text size) > 0 - and: [ (text runLengthFor: 1) = textSize ]]) ifTrue: [ | attribs | - attribs := text attributesAt: 1 forStyle: textStyle. - Text string: stringOrText copy attributes: attribs. - ] - ifFalse: [ Text fromString: stringOrText copy ] - ] - ifFalse: [ stringOrText copy asText. "should be veryDeepCopy?" ]. (text = newText and: [text runs = newText runs]) ifTrue: [^ self]. "No substantive change" text ifNotNil: [(embeddedMorphs := text embeddedMorphs) ifNotNil: [self removeAllMorphsIn: embeddedMorphs. embeddedMorphs do: [:m | m delete]]]. oldSelection := editor ifNotNil: [:ed | ed selectionInterval]. text := newText. "add all morphs off the visible region; they'll be moved into the right place when they become visible. (this can make the scrollable area too large, though)" newText embeddedMorphs do: [:m | self addMorph: m. m position: -1000 @ 0]. self releaseParagraph. "update the paragraph cache" self paragraph. oldSelection ifNotNil: [:sel | self selectFrom: sel first to: sel last]. "re-instantiate to set bounds" self world ifNotNil: [self world startSteppingSubmorphsOf: self]! |
On 20.07.2016, at 21:03, [hidden email] wrote: > Patrick Rein uploaded a new version of Morphic to project The Trunk: > http://source.squeak.org/trunk/Morphic-pre.1192.mcz > > ==================== Summary ==================== > > Name: Morphic-pre.1192 > Author: pre > Time: 20 July 2016, 11:03:12.063382 pm > UUID: bd2a03f6-120a-d543-af91-d4535051c547 > Ancestors: Morphic-mt.1191 > > Removing code from the TextMorph which copied text attributes from the old content to the new content in certain cases. > Yes, but now the comment is wrong. > =============== Diff against Morphic-mt.1191 =============== > > Item was changed: |
In reply to this post by commits-2
Hi Patrick, this does the same job: ... newText := stringOrText copy asText. ... Because Text >> #asText does not create a new instance of Text for a Text. Best, Marcel |
Free forum by Nabble | Edit this page |