window(wrap): refactor word wrap
Commit 74fb13079794 "fix: `Window.printSegments` correctly prints all
non-trailing whitespace" fixed some bugs with word wrapping, but also
introduced a bug with printing leading whitespace in a segment.
Refactor the entire word wrap logic to use a custom LineIterator and a
tokenizer which gives whitespace tokens as well.