Skipping spaces at ends of line used to be done only when ok != here
(a potential line break was found).
Moved this logic up one level to handle all cases.
Also moved maxLine test in the block that actually adds a new line.
Updated the unit tests accordingly.
Change-Id: Ib10bc838b1ffa5b8a60259ea4b622d9fecb2ec70