Message122246
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. |
|
Date |
User |
Action |
Args |
2010-11-23 21:34:06 | tlynn | set | recipients:
+ tlynn, gvanrossum, gward, georg.brandl, terry.reedy, mark.dickinson, palfrey, jerith, mrabarnett, BreamoreBoy |
2010-11-23 21:34:05 | tlynn | set | messageid: <1290548045.62.0.753348686502.issue1859@psf.upfronthosting.co.za> |
2010-11-23 21:34:02 | tlynn | link | issue1859 messages |
2010-11-23 21:34:02 | tlynn | create | |
|