It does not seem that RubScrolledTextMorph supports duplication/copy (tried to 
duplicate one from nautilus code area and the same clear all code happened. 
Trying to duplicate a Playground just freezes the image (might be some circular 
references that is not handled when copying )).

Anyway: this code works ish.. (does not add unaccepted edits)

CodeCard>>#duplicate
        | newCard |
        
        newCard := self class new.
        newCard 
        selector: self selector; "must be before selectedClass"
        selectedClass: self selectedClass;
        updateCodeWith: self textModel text.
        self activeHand attachMorph: newCard. "attachMorph: is nicer than 
grabMorph: :)"
        selected := false.
        self changed.


Best regards,
Henrik

-----Original Message-----
From: Pharo-dev [mailto:[email protected]] On Behalf Of Stephan 
Eggermont
Sent: Friday, September 18, 2015 6:19 PM
To: [email protected]
Subject: Re: [Pharo-dev] RubAbstractTextArea copying

On 18-09-15 16:50, Henrik Nergaard wrote:
> I looked into the bug a bit and found something strange....
>
> | m m2 |
>
> m := ColorPanel open.
> m2 := m submorphs third copy.
> m = m2 panel. "prints false; the panel is duplicated "

Yes, that is a bug, that should stay the same.

> add this method to DragWelL:
>
> veryDeepInner: deepCopier
>       super veryDeepInner: deepCopier

That seems to work.

> Another observation is that after all the text is lost,
 > if you have a Playground that is effected and try to do  > something like: 
 > (ColorPanel allInstances size.) it raises  > an error 'MessageNotUnderstood: 
 > receiver of "style:" is nil'
 > from "a GLMMorphicPharoPlaygroundRenderer actOnHighlightAndEvaluate: ann"

Yes. All editors break. That is independent of the ColorPanel, I've verified 
with the cloning of cards. I just don't know how I can safely copy a Rubric 
editor morph. Either directly, or through its textModel.

Stephan



Reply via email to