pioneerspacesim/pioneer — pull request #2488 by robn (2013-10-13 02:41:40+00:00)
Title: Supply a preferred size for MultiLineText

Because there's so many ways to "correctly" lay out a block of text, `MultiLineText` always just washed its hands of the whole thing and returned a "I don't care" preferred size, leaving it to the container to choose. For containers where it determines size and layout based on the wants of its children, this always resulted in a `MultiLineText` receiving what it asked for - nothing. That made it impossible do things like a nice dialog box where the background would shrinkwrap its content.

It turns out that in the absence of any other information, there's one thing we do know about a body of text - it needs to be readable! According to [this blog post](http://baymard.com/blog/line-length-readability) the optimal line length is somewhere between 50 and 75 characters. After that the eyes the brain start to lose focus.

So now we do an intiial layout of about 75 characters and report the result as the preferred size. The container can still choose to ignore that, as it can for all widgets. But for the ones that use the preferred size to calculate layout, they'll now produce something sane.

![snap](https://f.cloud.github.com/assets/130670/1321321/e80ea932-33b0-11e3-8c6b-63d7f557b40d.png)