[BUG] Embedded TextMorph autoFill with empty text problem!

John R. Pierce john at pierce.name
Tue Jun 22 19:32:00 UTC 2004

Hi all,

I uncovered a problem with TextMorph's that are embedded in Morphs with the
autofill property turned on.  It seems to exhibit itself in both 3.6 and 3.7.

Basically, if the underlying text of the TextMorph gets set to an empty string,
then when the user starts typing in an empty TextMorph, the new text will not
get shown until a layoutChanged is called (and subsequent repaint cycle).

It appears TextMorph>>updateFromParagraph does call layoutChanged, but that call
doesn't seem to help.  Attached is a little bit of code to see the problem:

  morph := Morph new.
  morph extent: 100 @ 20.
  text := TextMorph new.
  morph addMorph: text.
	color: Color white;
	contents: ''.
  morph openInWorld.

  "Now go try to type in the TextMorph and see what I mean"

  "Then run the following code to get the TextMorph to re-display the new text"
  text layoutChanged.
  morph invalidRect: morph bounds.  "This is only necessary on 3.6"

If you use a larger embedding morph then the one I had in my sample, you will
actually see the new text showing up on the second line of the morph.  This may
be a clue as to what is going on.

Lastly, I noticed this can be fixed by hacking updateFromParagraph and adding an
"ActiveWorld doOneCycle" call right after the call to "self fit" (near the top
of the method).



More information about the Squeak-dev mailing list