Issue #647, fix newline handling edge case.

I don't think this will work as intended in presence of tabs. We should probably expand tabs first, wrap lines next and only then attach these space thingies after newlines where necessary.