[squeak-dev] TextMorphForEditView calls #textEdited: after every cmd action

Christoph Thiede christoph.thiede at outlook.de
Thu Jul 18 17:13:37 UTC 2019


Hi all,

I did not found out whether this is a known bug/limitation: When you press
<Cmd-a>, <Cmd-i> or any other shortcut that raises a read-only operation
into a TextMorphForEditView, #textEdited: is called. This is caused by the
"guess editing" in TextMorphForEditView>>#keyStroke:. I think this is an
unwanted behavior as some views might schedule some relevant behavior to any
real text edition. (For example, we are working at a sheet tool which
activates an edit mode when any edit is received. It is irritating to get
the edit mode activated whenever some text is selected via keyboard.)

I first tried to add another condition to the cheap check



but then, events like Control Paste did not raise a #keyStroke: call. Marcel
proposed the alternative to compare old and new contents. Personally, I
would not find this solution ideal, as it is possible that the view decides
to change its contents when the text is edited, and in this case it would
receive #textEdited: just after the keystroke. (Our sheet tool does so, by
the way. Do you think this is a non-abusing implementation? In our concrete
case, the alternative would be to override both PluggableTextMorphPlus and
TextMorphForEditView.)

Is there any existing hook to identify the latest modifying event/user
operation that could be used for a cheap check here? As someone who is not
familiar with Morphic-TextSupport, my best idea would be adding a state
variable (wasEdited) to the Editor, resetting it before calling super
keyStroke: and testing it afterwards. In case of TextEditors, it _might_ be
an option to consult its history (?), but that wouldn't be an universal
solution? I do not really find that would be beautiful solutions, and would
welcome any better proposals to learn from them.

Best,
Christoph



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


More information about the Squeak-dev mailing list