[squeak-dev] The Trunk: Morphic-nice.695.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Fri Oct 4 22:22:45 UTC 2013


I hope everyone understands now why it is better to maintain a single
CharacterScanner hierarchy :)
And why this hierarchy should be as clean as possible
(try to limit the occurrence of code smells like too many states, too long
methods, too many ifTrue:ifFalse: etc...)
Trying to correct these glitches in two hierarchies with small state
machine differences is a nightmare.


2013/10/5 <commits at source.squeak.org>

> Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-nice.695.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-nice.695
> Author: nice
> Time: 5 October 2013, 12:05:58.658 am
> UUID: c0320b47-c05e-4f35-ae13-9faee7640629
> Ancestors: Morphic-nice.694
>
> A TextAnchor should not try to directly #placeEmbeddedObject: when
> emphasizing the scanner.
> Indeed, a scanner requests the Text to apply emphasis/attributes at an
> initialization stage (setFont).
> It is the scanner scan loop which is responsible for composing the text.
> Since this initialization happens outside the scan loop, the scanner is
> not yet ready to place anything.
>
> The placement will happen later when the scanner is willing to, by the
> following mechanism:
> - every TextAnchor is associated with a (Character value: 1).
> - there is a stopCondition associated to this value which will be
> processed in the scan loop and invoke #embeddedObject.
> - #embeddedObject will send #placeEmbeddedObject:
>
> Restoring this method from 12 years ago fixes a glitch when the embedded
> morph crosses the right margin.
> The glitch is due to a setFont which is sent from inside the scan loop in
> some conditions and incorrectly increments twice the morph display position.
>
> =============== Diff against Morphic-nice.694 ===============
>
> Item was changed:
>   ----- Method: TextAnchor>>emphasizeScanner: (in category 'visiting')
> -----
> + emphasizeScanner: scanner
> +       "Do nothing for emphasizing the scanner - if the anchor is valid a
> #embeddedObject will be encountered by the scanner and do the real thing"!
> - emphasizeScanner: aScanner
> -       self anchoredMorph ifNil: [ ^ self ].
> -       aScanner placeEmbeddedObject: self anchoredMorph.!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20131005/a285e98a/attachment.htm


More information about the Squeak-dev mailing list