<div dir="ltr">Hello!<br><br><div>While working on the last bugfix, I've noticed that <span style="font-family:monospace">Object>>printAs:limitedTo:</span> (which is used by <span style="font-family:monospace">#printString</span> and <span style="font-family:monospace">#printStringLimitedTo:</span>) answers 4 characters more than its limit whenever it has to truncate the string.</div><div><br></div><div>For example, with <span style="font-family:monospace">Object new</span> (whose print string is <span style="font-family:monospace">'an Object'</span>, 9 characters):</div><div style="margin-left:40px"><span style="font-family:monospace">Object new printStringLimitedTo: 5 " => 'an Ob[..]' (size 9)"</span><br><span style="font-family:monospace">Object new printStringLimitedTo: 9 " => 'an Object[..]' (size 13)"</span><br></div><br>I don't know if this is the expected behavior, but I've found it a bit weird. I think there are two problems in the current implementation:<br>1. When the string is truncated, it just appends the <span style="font-family:monospace">'[..]'</span> marker on top of the limit, so every truncated result is 4 characters over the limit.<br>2. It compares with <span style="font-family:monospace">#<</span> instead of <span style="font-family:monospace">#<=,</span> so a description that fits the limit exactly is truncated and gets the marker too (like in the second example above).<br><br>So, I attach three change sets:<br><ul><li><span style="font-family:monospace">KernelTests-Object_printAs_limitedTo</span> incudes two new tests in <span style="font-family:monospace">ObjectTest</span> that reproduce the problematic cases.</li><li><span style="font-family:monospace">CuisCore-Object_printAs_limitedTo</span> contains the fix to <span style="font-family:monospace">Object>>printAs:limitedTo:</span>, and the same fix in <span style="font-family:monospace">BreakingMethodWrapper>>printAs:limitedTo:</span> (the wrapper is a ProtoObject subclass with its own copy of the method).</li><li><span style="font-family:monospace">CuisCore-printStringLimitedTo_sendersLeaveRoomForMarker</span> is a small change to two senders that calculate the limit using a floor of 1. With the old code, a truncated string showed one character plus the marker. But with the new code it would show just the marker, so I raised the floor to 5 (so it works as before, since the marker has size 4).</li></ul><div>I wasn't sure what the expected behavior was, so I went to what I thought could be reasonable, or at least be an improvement to what we already have.</div><div><br></div>Cheers!<br>Facu</div>