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

Chris Muller asqueaker at gmail.com
Sat Oct 5 18:14:42 UTC 2013


This seems to have fixed a long-standing bug where embedded morphs
which were the first character of a line would not be flush against
the left margin.  They would be either centered or at least "indented"
somewhat.  Really really excellent fix!

I don't think anyone was against a single CharacterScanner hierarchy,
but perhaps simply nervous about venturing down a "cleanup" path that
could be difficult to get out of if things didn't go as well as you
have them going.  A lot of apps depend on this stuff.  Kudos to you
and Tim for digging into it and the excellent work you've done.

On Fri, Oct 4, 2013 at 5:22 PM, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> 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.!
>>
>>
>
>
>
>


More information about the Squeak-dev mailing list