<div dir="ltr"><div><div>I hope everyone understands now why it is better to maintain a single CharacterScanner hierarchy :)<br></div>And why this hierarchy should be as clean as possible<br>(try to limit the occurrence of code smells like too many states, too long methods, too many ifTrue:ifFalse: etc...)<br>
</div>Trying to correct these glitches in two hierarchies with small state machine differences is a nightmare.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/5  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nicolas Cellier uploaded a new version of Morphic to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Morphic-nice.695.mcz" target="_blank">http://source.squeak.org/trunk/Morphic-nice.695.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Morphic-nice.695<br>
Author: nice<br>
Time: 5 October 2013, 12:05:58.658 am<br>
UUID: c0320b47-c05e-4f35-ae13-9faee7640629<br>
Ancestors: Morphic-nice.694<br>
<br>
A TextAnchor should not try to directly #placeEmbeddedObject: when emphasizing the scanner.<br>
Indeed, a scanner requests the Text to apply emphasis/attributes at an initialization stage (setFont).<br>
It is the scanner scan loop which is responsible for composing the text.<br>
Since this initialization happens outside the scan loop, the scanner is not yet ready to place anything.<br>
<br>
The placement will happen later when the scanner is willing to, by the following mechanism:<br>
- every TextAnchor is associated with a (Character value: 1).<br>
- there is a stopCondition associated to this value which will be processed in the scan loop and invoke #embeddedObject.<br>
- #embeddedObject will send #placeEmbeddedObject:<br>
<br>
Restoring this method from 12 years ago fixes a glitch when the embedded morph crosses the right margin.<br>
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.<br>
<br>
=============== Diff against Morphic-nice.694 ===============<br>
<br>
Item was changed:<br>
  ----- Method: TextAnchor&gt;&gt;emphasizeScanner: (in category &#39;visiting&#39;) -----<br>
+ emphasizeScanner: scanner<br>
+       &quot;Do nothing for emphasizing the scanner - if the anchor is valid a #embeddedObject will be encountered by the scanner and do the real thing&quot;!<br>
- emphasizeScanner: aScanner<br>
-       self anchoredMorph ifNil: [ ^ self ].<br>
-       aScanner placeEmbeddedObject: self anchoredMorph.!<br>
<br>
<br>
</blockquote></div><br></div>