Fix #1 --- infinite loop in text.Wrap

I'm hoping that this fixes #1.

I don't completely grok the algorithm yet, so I'm not sure if I've broken anything. But the tests pass.