[squeak-dev] Weird text composition when tab happens at large destX

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Wed May 15 19:36:31 UTC 2019

the (attached) text composition bugs me:
When a tab occurs after some column, the composition creates a new line,
even when there is room for more text...
I tried to create a test case in CharacterScannerTest

| p text chunkWidth expectedChunkStartX expectedWidth |
text := (String new: 59 streamContents: [:str | (String new: 14 withAll:
$m) do: [:m | 5 timesRepeat: [str nextPut: m]] separatedBy: [str tab]])
chunkWidth := 5*mWidth.
expectedChunkStartX := Array new: 14 streamContents:
[:str |
(1 to: 14) inject: 1 into:
[:destX :rank |
str nextPut: destX.
(style nextTabXFrom: destX + chunkWidth leftMargin: 0 rightMargin: 0)]].
expectedWidth := expectedChunkStartX last + chunkWidth.
p := NewParagraph new.
compose: text
style: style
from: 1
in: (0 @ 0 corner: expectedWidth+10 @ (style lineGrid * 2)).
self assert: p lines size = 1 description: 'There is enough composition
width for this text'.

but the test pass (it composes in single line). Any idea where to look at?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190515/52630833/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WeirdComposition.png
Type: image/png
Size: 11215 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190515/52630833/attachment-0001.png>

More information about the Squeak-dev mailing list