Tom Lynn <[email protected]> added the comment:
I've also been attempting to look into this and came up with an almost
identical patch, which is promising:
https://bitbucket.org/tlynn/issue1859/diff/textwrap.py?diff2=041c9deb90a2&diff1=f2c093077fbf
I missed the wordsep_simple_re though.
Testing it is the hard part. I've got a few examples that could become tests
in that repository, but it's far from conclusive.
One corner case I found is trailing whitespace becoming a blank line:
>>> from textwrap import TextWrapper
>>> T = TextWrapper(replace_whitespace=False, drop_whitespace=False, width=9)
>>> T.wrap('x'*9 + ' \nfoo')
['xxxxxxxxx', ' ', 'foo']
I think it's fine. drop_whitespace=True removes the blank line, and those who
really want drop_whitespace=False can remove the blank lines easily.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1859>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com