The Inbox: Morphic-mt.1520.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-mt.1520.mcz

commits-2
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-mt.1520.mcz

==================== Summary ====================

Name: Morphic-mt.1520
Author: mt
Time: 16 September 2019, 1:35:41.298794 pm
UUID: b3397a5b-4928-7647-80c7-f6ab8655445f
Ancestors: Morphic-mt.1519

Avoid resetting wrapFlag or autoFit when setting new contents in TextMorph.

=============== Diff against Morphic-mt.1519 ===============

Item was changed:
  ----- Method: TextMorph>>contents: (in category 'accessing') -----
  contents: stringOrText
+ ^ self newContents: stringOrText!
- ^ self contentsAsIs: stringOrText!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-mt.1520.mcz

Hannes Hirzel
Good catch!

Test cases?

--Hannes

On Mon, 16 Sep 2019 11:35:48 0000, [hidden email]
<[hidden email]> wrote:

> A new version of Morphic was added to project The Inbox:
> http://source.squeak.org/inbox/Morphic-mt.1520.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1520
> Author: mt
> Time: 16 September 2019, 1:35:41.298794 pm
> UUID: b3397a5b-4928-7647-80c7-f6ab8655445f
> Ancestors: Morphic-mt.1519
>
> Avoid resetting wrapFlag or autoFit when setting new contents in TextMorph.
>
> =============== Diff against Morphic-mt.1519 ===============
>
> Item was changed:
>   ----- Method: TextMorph>>contents: (in category 'accessing') -----
>   contents: stringOrText
> + ^ self newContents: stringOrText!
> - ^ self contentsAsIs: stringOrText!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-mt.1520.mcz

marcel.taeumel
Maybe via Etoys?

Best,
Marcel

Am 16.09.2019 14:24:08 schrieb H. Hirzel <[hidden email]>:

Good catch!

Test cases?

--Hannes

On Mon, 16 Sep 2019 11:35:48 0000, [hidden email]
wrote:
> A new version of Morphic was added to project The Inbox:
> http://source.squeak.org/inbox/Morphic-mt.1520.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1520
> Author: mt
> Time: 16 September 2019, 1:35:41.298794 pm
> UUID: b3397a5b-4928-7647-80c7-f6ab8655445f
> Ancestors: Morphic-mt.1519
>
> Avoid resetting wrapFlag or autoFit when setting new contents in TextMorph.
>
> =============== Diff against Morphic-mt.1519 ===============
>
> Item was changed:
> ----- Method: TextMorph>>contents: (in category 'accessing') -----
> contents: stringOrText
> + ^ self newContents: stringOrText!
> - ^ self contentsAsIs: stringOrText!
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-mt.1520.mcz

Beckmann, Tom
In reply to this post by Hannes Hirzel
Hi Hannes,

I'm currently compiling a list of testcases for the TableLayout, in particular also testing its interplay with the TextMorph. Are there any particular scenarios you'd like to see covered, maybe also verifying some legacy behavior in this case? If not, I'll just keep looking what makes sense to me and put it up on the inbox in a day or two, likely already assuming that this patch will land (and if it can't get merged for some reason, adjusting the tests).

Best,
Tom
________________________________________
From: Squeak-dev <[hidden email]> on behalf of H. Hirzel <[hidden email]>
Sent: Monday, September 16, 2019 2:23 PM
To: [hidden email]
Subject: Re: [squeak-dev] The Inbox: Morphic-mt.1520.mcz

Good catch!

Test cases?

--Hannes

On Mon, 16 Sep 2019 11:35:48 0000, [hidden email]
<[hidden email]> wrote:

> A new version of Morphic was added to project The Inbox:
> http://source.squeak.org/inbox/Morphic-mt.1520.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1520
> Author: mt
> Time: 16 September 2019, 1:35:41.298794 pm
> UUID: b3397a5b-4928-7647-80c7-f6ab8655445f
> Ancestors: Morphic-mt.1519
>
> Avoid resetting wrapFlag or autoFit when setting new contents in TextMorph.
>
> =============== Diff against Morphic-mt.1519 ===============
>
> Item was changed:
>   ----- Method: TextMorph>>contents: (in category 'accessing') -----
>   contents: stringOrText
> +     ^ self newContents: stringOrText!
> -     ^ self contentsAsIs: stringOrText!
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-mt.1520.mcz

Hannes Hirzel
Hi Tom

I think also a good test is code inspection

you replace
    #contentsAsIs:
with
    #newContents:


contentsAsIs: stringOrText
        "Accept new text contents with line breaks only as in the text.
        Fit my width and height to the result."
        wrapFlag := false.
        container ifNotNil: [container fillsOwner ifTrue: [wrapFlag := true]].
        self newContents: stringOrText



newContents: stringOrText
        "Accept new text contents."
        | newText embeddedMorphs oldSelection |
        newText := stringOrText isString
                ifTrue: [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]


From this point of view I think it should be commited to trunk.

The test cases you prepare for TableLayout and the interplay with
TextMorph will be of good value.

Also tests like this https://wiki.squeak.org/squeak/2765 ?

Regards
Hannes

On 9/17/19, Beckmann, Tom <[hidden email]> wrote:

> Hi Hannes,
>
> I'm currently compiling a list of testcases for the TableLayout, in
> particular also testing its interplay with the TextMorph. Are there any
> particular scenarios you'd like to see covered, maybe also verifying some
> legacy behavior in this case? If not, I'll just keep looking what makes
> sense to me and put it up on the inbox in a day or two, likely already
> assuming that this patch will land (and if it can't get merged for some
> reason, adjusting the tests).
>
> Best,
> Tom
> ________________________________________
> From: Squeak-dev <[hidden email]> on behalf
> of H. Hirzel <[hidden email]>
> Sent: Monday, September 16, 2019 2:23 PM
> To: [hidden email]
> Subject: Re: [squeak-dev] The Inbox: Morphic-mt.1520.mcz
>
> Good catch!
>
> Test cases?
>
> --Hannes
>
> On Mon, 16 Sep 2019 11:35:48 0000, [hidden email]
> <[hidden email]> wrote:
>> A new version of Morphic was added to project The Inbox:
>> http://source.squeak.org/inbox/Morphic-mt.1520.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Morphic-mt.1520
>> Author: mt
>> Time: 16 September 2019, 1:35:41.298794 pm
>> UUID: b3397a5b-4928-7647-80c7-f6ab8655445f
>> Ancestors: Morphic-mt.1519
>>
>> Avoid resetting wrapFlag or autoFit when setting new contents in
>> TextMorph.
>>
>> =============== Diff against Morphic-mt.1519 ===============
>>
>> Item was changed:
>>   ----- Method: TextMorph>>contents: (in category 'accessing') -----
>>   contents: stringOrText
>> +     ^ self newContents: stringOrText!
>> -     ^ self contentsAsIs: stringOrText!
>>
>>
>>
>
>
>