[squeak-dev] The Inbox: ToolBuilder-Morphic-ct.234.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Aug 6 12:41:08 UTC 2019


Hi Marcel,


ok, I assumed #updateStyle would be only sent if styling is active, but I was wrong. I knew this handy styling shortcut before, and just found out that your proposed condition maybe would not be sufficient: As Shout preserves some styles (for example TextDoIts), it would be a pity to delete them when you disable syntax highlighting in Workspace. This is also what happens in Squeak-5.2, so I would like to keep Tools-ct.867.


Just one proposal to solve this:


updateStyleNow

styler ifNil: [^ self].
self okToStyle
ifTrue: [styler style: textMorph contents]
ifFalse: [textMorph contents: (styler unstyledTextFrom: textMorph contents)].

(#updateStyle analogously)

This preserves custom stylings when you toggle styling in Workspace.

---

It still does not work perfect, I think there are kept too many attributes after toggling styling off:

[cid:982db5da-e636-4aeb-914b-eeabd309f122]
(custom attributes: one TextDoIt, one TextURL)
becomes to
[cid:5788ce00-d4fb-40e4-bc6d-01ca7c2f88e7]

I wonder why #unstyledTextFrom: handles all attributes on this binary way? I changed it

unstyledTextFrom: aText
"Re-implemented so that TextActions are not removed from aText"
| answer |
answer := super unstyledTextFrom: aText.
aText runs withStartStopAndValueDo: [:start :stop :attribs |
+ attribs
+ select: [:each | each shoutShouldPreserve]
+ thenDo: [:each | answer addAttribute: each from: start to: stop]].
- (attribs anySatisfy: [:each | each shoutShouldPreserve])
- ifTrue: [
- attribs do: [:eachAttrib | answer addAttribute: eachAttrib from: start to: stop]]].
^answer

and it looks like this:

[cid:acb3ae0a-e2e1-42a7-8f3c-a5dc5bbddb2d]

Are there any reasons for the current implementation of #unstyledTextFrom:? Looking forward to your opinions :)

Best,
Christoph

Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Dienstag, 6. August 2019 09:22:37
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] The Inbox: ToolBuilder-Morphic-ct.234.mcz

Hi Christoph,

this is not working. We have to support manual styling and cannot just remove text attributes there. Maybe if we check whether "styer" is set. Even then, we should follow the logic in PluggableTextMorphPlus >> #stylerStyled: to remove those text attributes.

Btw: You can style a piece of text manually via the context menu or [CMD]+[6..0].

Best,
Marcel

Am 05.08.2019 14:50:20 schrieb commits at source.squeak.org <commits at source.squeak.org>:

A new version of ToolBuilder-Morphic was added to project The Inbox:
http://source.squeak.org/inbox/ToolBuilder-Morphic-ct.234.mcz

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

Name: ToolBuilder-Morphic-ct.234
Author: ct
Time: 5 August 2019, 2:50:11.900062 pm
UUID: f6987fae-9cfa-4e44-927f-247f4eeb868e
Ancestors: ToolBuilder-Morphic-mt.233

Extend #updateStyle(Now) to remove obsolete styling

A call of #updateStyle(Now) implies that the text morph is used for styling, so it is not capable of storing other styles we could accidentally delete here.

=============== Diff against ToolBuilder-Morphic-mt.233 ===============

Item was changed:
----- Method: PluggableTextMorphPlus>>updateStyle (in category 'styling') -----
updateStyle

self okToStyle
+ ifTrue: [styler styleInBackgroundProcess: textMorph contents]
+ ifFalse: [textMorph contents: textMorph contents asString].!
- ifTrue: [styler styleInBackgroundProcess: textMorph contents].!

Item was changed:
----- Method: PluggableTextMorphPlus>>updateStyleNow (in category 'styling') -----
updateStyleNow

self okToStyle
+ ifTrue: [styler style: textMorph contents]
+ ifFalse: [textMorph contents: textMorph contents asString].!
- ifTrue: [styler style: textMorph contents].!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190806/418c2401/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 4084 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190806/418c2401/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 4062 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190806/418c2401/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 5123 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190806/418c2401/attachment-0002.png>


More information about the Squeak-dev mailing list