<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 4, 2019 at 8:50 PM karl ramberg <<a href="mailto:karlramberg@gmail.com">karlramberg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>The code in NewParagraph>>adjustRightX is broken. <br></div><div>It seem to expect a container that is a Rectangle and not a TextContainer.</div><div>This method must be made to work with TextContainer.<br></div><div><br></div><div>NewParagraph>>adjustRightX<br>       | shrink |<br>    shrink := container right - maxRightX.<br>        lines do: [:line | line paddingWidth: (line paddingWidth - shrink)].<br>  container := container withRight: maxRightX + self caretWidth.</div><div><br></div><div>Best,</div><div>Karl</div></div></blockquote><div><br></div><div>NewParagraph seems to sometimes have Rectangle as container  and sometimes a TextContainer.</div><div>I'm not sure what to do about that...</div><div><br></div><div>Best,</div><div>Karl<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 3, 2019 at 8:26 PM Rein, Patrick <<a href="mailto:Patrick.Rein@hpi.de" target="_blank">Patrick.Rein@hpi.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Karl,<br>
<br>
I agree that the drag and drop handling of TextMorphs is somewhat complex by now.  While looking into the issue I found two kinds of issues: some more general ones and one related to layouting.<br>
<br>
## General Occlusion Bug<br>
<br>
I have to admit that I was not aware of the avoid occlusions feature. I dug into it a little and<br>
found TextContainer and the class comment which explains the feature. Then I constructed<br>
the following example:<br>
<br>
o := Morph new.<br>
tm := TextMorph new<br>
        contents: 'This is a very long text with a lot of characters<br>
spanning multiple lines overall and throughout the<br>
place in order to trigger the occlusion thing';<br>
        yourself.<br>
m := RectangleMorph new.<br>
m position: tm topLeft + (10@10).<br>
tm occlusionsOnOff.<br>
o addMorph: tm.<br>
o addMorph: m.<br>
o openInWorld.<br>
<br>
I tried it in trunk and Squeak 3.8 and in both it results in errors in NewParagraph>>#adjustRightX as<br>
it expects container to behave like a rectangle.<br>
<br>
However, the root cause seems to be that #adjustRightX does not make sense when having a fixed<br>
TextContainer as it describes the individual rectangles in which the text can be set. One solution is<br>
to set `tm wrapFlag: true` before turning avoidOcclusions on (otherwise #wrapFlag triggers a relayout<br>
without tm having an owner which does not work...).<br>
<br>
To make this more robust I would propose:<br>
1.) When activating occlusion we also set the wrapFlag<br>
2.) We do not try to avoid occlusions as long as the morph does not have an owner yet.<br>
<br>
## Text Anchor Related<br>
<br>
Maybe this is more what you were thinking about Karl: I found that when having the above example<br>
plus an anchored morph which is layouted inline most things work fine. Except for the layout issue<br>
you can see in the attachment (the first morph in the third line is the anchored morph, the second one<br>
is the m from the example above). The second part of the third line does not adhere to the offset of the<br>
first part of the line. @Karl: Did you refer to that? (Not sure how to fix this yet...)<br>
<br>
Bests<br>
Patrick<br>
________________________________________<br>
From: Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> on behalf of karl ramberg <<a href="mailto:karlramberg@gmail.com" target="_blank">karlramberg@gmail.com</a>><br>
Sent: Monday, July 1, 2019 11:44:34 AM<br>
To: Chris Muller<br>
Cc: The general-purpose Squeak developers list<br>
Subject: Re: [squeak-dev] Proposal: Morphs in Text<br>
<br>
One big issue with the drag and drop is that it is often not clear which morph one drop into.<br>
There are so many layers of morphs in a text window so it gets confusing to know which morph to actually<br>
enable to accepting the drop.<br>
<br>
But drag and drop are probably a separate issue from text anchors constructed from<br>
code. Just don't break it to badly  :-)<br>
<br>
<br>
Best,<br>
Karl<br>
<br>
<br>
<br>
Best.<br>
Karl<br>
<br>
<br>
<br>
On Mon, Jul 1, 2019 at 2:19 AM Chris Muller <<a href="mailto:ma.chris.m@gmail.com" target="_blank">ma.chris.m@gmail.com</a><mailto:<a href="mailto:ma.chris.m@gmail.com" target="_blank">ma.chris.m@gmail.com</a>>> wrote:<br>
> I'm a little late here.<br>
> TextMorph does not really need TextAnchor I think.<br>
> You can just drop morphs on the text and select avoid occlusions in the menu.<br>
> What are the use of text anchors instead just dropped in morphs ?<br>
> I filed in TextAnchorPlacement change set and it interferes somewhat with the avoid occlusions functions.<br>
<br>
I was wondering about the 'avoid occlusions' but spent all my focus on<br>
the alignment testing, thanks for testing that too!<br>
<br>
We should not break that.  I like this new alignment capability, but<br>
classic DTP text-handling is one of Squeak's most impressive<br>
capabilities.  Hopefully an easy fix..?<br>
<br>
<br>
 - Chris<br>
<br>
</blockquote></div>
</blockquote></div></div>