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

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Wed Aug 7 12:45:54 UTC 2019


Hi Marcel,


I got it :) If it is not ok to style, #updateStyle will periodically reset all attributes possibly relating to Shout. One option would be to remove these styles once in Workspace>>#toggleStyling:. Or we could introduce a state variable for this purpose in PluggableTextMorphPlus itself.


Another approach: Maybe I misunderstood Tim Rowledge, but would it be an option to introduce an additional TextAttribute that assigns substrings to Shout? Such a TextSyntaxHighlight style would complement the effect of Morphic-mt.1498, but also allow you, for example, to format a code example in a class comment without hard-coding the current ui theme & environment. In Workspace, #toggleStyling then could add or remove such an attribute from the whole text.


One open question would be where to store the styling information? But I think it could be left in the styler instance, so TextSyntaxHighlight would only specify that something should be styled, but #aboutToStyle: was responsible for specifying the contextual information.


Best,

Christoph

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Mittwoch, 7. August 2019 09:38:53
An: John Pfersich via Squeak-dev; squeak-dev at mail.squeak.org
Betreff: Re: [squeak-dev] The Inbox: ToolBuilder-Morphic-ct.234.mcz

Hi Christoph,

- open a workspace
- type something
- select something
- hit CMD+6 or 7 or 8 to style something

That must work. :-)

Best,
Marcel

Am 07.08.2019 09:33:55 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:

Hi,


what exactly "doesn't do" it? Toggling styling and keeping custom stylings in Workspace by using the version from your screenshot worked for me.


#unstyledTextFrom: - are there any tests for this behavior? Should we change the implementation in the Inbox?


Best,

Christoph

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

Hi, there.

There has to be a way to allow manual styling in workspaces. This doesn't do it:

[cid:1404af3b-7074-4941-a6a3-25cb08aeb95e]

Yeah, I have no idea, why #unstyledTextFrom: keeps so many attributes. Has been this way like forever:

[cid:39c362b7-1cf4-4782-bed1-1e58e6487250]

Best,
Marcel

Am 06.08.2019 14:41:19 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:

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/20190807/b77578e6/attachment.html>


More information about the Squeak-dev mailing list