<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
 --></style><title>[BUG][FIX]TextStream
nextPutAll:</title></head><body>
<div>Folks,</div>
<div><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>Here is
a surprising bug, and a fix for it.&nbsp; If you execute this:</div>
<div><br></div>
<div>WW _ Workspace prototypicalToolWindow. </div>
<div>WW openInWorld.</div>
<div>(WW findA: PluggableTextMorph) editString: (Text streamContents:
[:strm |<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>24 timesRepeat:
[<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </x-tab>strm
nextPutAll: 'This text is ' asText, 'bold ' asText allBold]])</div>
<div><br></div>
<div>The Workspace will contain:</div>
<div>This text is<b> bold</b> This text is<b> bold</b> This text is<b>
bold</b> This text is<b> bold</b> This text is<b> bold</b> This text
is<b> bold</b> This text is<b> bold</b> This text is<b> bold</b> This
text is<b> bold</b> This text is<b> bold</b> This text is<b> bold</b>
This text is<b> bold</b> This text is<b> bold</b> This text is<b>
bold</b> This text is<b> bold</b> This text is<b> bold</b> This text
is<b> bold</b> This text is<b> bold</b> This text is<b> bold</b> This
text is<b> bold</b> This text is<b> bold</b> This text is<b> bold</b>
This text is bold This text is<b> bold</b></div>
<div><br></div>
<div>Notice that the next to last 'bold' is NOT bold!&nbsp; How could
this happen?</div>
<div><br></div>
<div>In TextStream nextPutAll: the code calls super when the new text
overflows the buffer collection.&nbsp; Super, however, treats the
argument as a String, not as Text.&nbsp; It throws away the attribute
information for that piece of text.</div>
<div><br></div>
<div>Enclosed is a fix.&nbsp; It is from Squeak 3.2, but it will work
in any modern version.&nbsp; I tested it in 3.7alpha.</div>
<div><br></div>
<div>--Ted.</div>
<div><br></div>
<x-sigsep><pre>-- 
</pre></x-sigsep>
<div><font face="New York" color="#000000">Ted
Kaehler&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
http://www.squeakland.org/~ted/</font></div>
</body>
</html>