[squeak-dev] Possible bug in PluggableTextMorph: Selection is reversed when rehovering text

Marcel Taeumel marcel.taeumel at hpi.de
Fri Aug 2 17:01:00 UTC 2019


Hi Christoph,

it might be possible to get rid of "selectionInterval" in PluggableTextMorph. This depends on the actual lifespan of the internal text editor in PluggableTextMorph. See #releaseEditor and #releaseParagraph in TextMorph. Regular text morphs (i.e. 'Hello' asText asMorph) do not preserve editor and selection on #mouseLeave:.

When working at text undo in TextEditor, I suspected that the editors in PluggableTextMorph live enough for that use case. So I did not add an extra inst-var for that.

We could try remove that "selectionInterval" variable and see what happens. I recall that at least keeping the selection stable after PluggableTextMorph >> #setText: is a good idea. At least then, both paragraph and editor will get replaced.

Note that selection affects scrolling for longer texts. If we lose selection at the wrong place, that big scroll field would just jump to the top again -- even if just changing a single character in that long text.

Best,
Marcel
Am 02.08.2019 18:37:11 schrieb Christoph Thiede <christoph.thiede at student.hpi.uni-potsdam.de>:
Hi,

I will quote the bug report from here

:

> - Open a workspace window, enter some text
> - press shift+left once
> - set the keyboard focus to another window
> - bring focus back to the Workspace
> - press shift+left once again
> Instead of selecting two characters, zero characters will be selected

The reason is in PluggableTextMorph>>#mouseEnter:, where the following is
done:
...textMorph editor selectInterval: selectionInterval...
As the selectionInterval is always positive, this operation destroys any
editor state where pointIndex <>

I just disabled this section in my image, and in a rush, I could not find
out what is missing. What has been the purpose of this snippet?
I also see this might be a debatable behavior: On the one hand, the user
might be irritated when he is returning to a textmorph after a long time,
trying to extend the selection with Arrow right but the selection is
shrinked indead. On the other hand, I have activated the
#mouseOverForKeyboardFocus setting (which is basically genius) and find it
annoying that the selection behavior changes after repositioning your mouse.
Has this ever been debated before?

I would welcome your opinions!

Best,
Christoph



--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190802/8c37e175/attachment.html>


More information about the Squeak-dev mailing list