[Pkg] The Trunk: Morphic-nice.695.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Oct 4 22:07:52 UTC 2013

Nicolas Cellier uploaded a new version of Morphic to project The Trunk:

==================== 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 Packages mailing list