[issue32397] textwrap output may change if you wrap a paragraph twice

2021-08-23 Thread Terry J. Reedy
Change by Terry J. Reedy : -- type: behavior -> enhancement versions: +Python 3.11 -Python 3.7, Python 3.8, Python 3.9 ___ Python tracker ___

[issue32397] textwrap output may change if you wrap a paragraph twice

2021-08-03 Thread Andrei Kulakov
Andrei Kulakov added the comment: I've added an initial draft PR: https://github.com/python/cpython/pull/27587/files I will add docs and news if this looks good in general. -- ___ Python tracker

[issue32397] textwrap output may change if you wrap a paragraph twice

2021-08-03 Thread Andrei Kulakov
Change by Andrei Kulakov : -- pull_requests: +26089 pull_request: https://github.com/python/cpython/pull/27587 ___ Python tracker ___

[issue32397] textwrap output may change if you wrap a paragraph twice

2021-08-03 Thread Andrei Kulakov
Andrei Kulakov added the comment: Note that I'm not handling a single '\r' because that was before Mac OS X; but it is handled by the following line (i.e. by the old logic): text = text.translate(self.unicode_whitespace_trans) -- ___

[issue32397] textwrap output may change if you wrap a paragraph twice

2021-08-03 Thread Andrei Kulakov
Andrei Kulakov added the comment: Irit: I assume you mean r' \r?\n', that's a great idea, it's much faster than adding a separate replacement step. Latest version I came up with is this: if re.search(r' \r?\n', text): text = re.sub(r' \r?\n', ' ', text)

[issue32397] textwrap output may change if you wrap a paragraph twice

2021-08-03 Thread Irit Katriel
Irit Katriel added the comment: You should be able to do them in one re, something like text = re.sub(r' ?\n', ' ', text) -- nosy: +iritkatriel ___ Python tracker ___

[issue32397] textwrap output may change if you wrap a paragraph twice

2021-08-03 Thread Andrei Kulakov
Andrei Kulakov added the comment: I think fix to make `drop_whitespace=False` stable, can be as simple as adding two lines in `_munge_whitespace()`: +text = re.sub(r' \n', ' ', text) +text = re.sub(r'\n ', ' ', text) text =

[issue32397] textwrap output may change if you wrap a paragraph twice

2021-08-02 Thread Andrei Kulakov
Andrei Kulakov added the comment: This issue is due to *drop_whitespace* arg being True by default. Documentation states that *drop_whitespace* applies after wrapping, so the fix in the PR would break that promise because, as far as I understand, it applies the wrapping after

[issue32397] textwrap output may change if you wrap a paragraph twice

2020-10-08 Thread Julien Palard
Julien Palard added the comment: Could be "related" to https://bugs.python.org/issue41975. -- nosy: +mdk ___ Python tracker ___

[issue32397] textwrap output may change if you wrap a paragraph twice

2019-10-20 Thread Cheryl Sabella
Change by Cheryl Sabella : -- versions: +Python 3.9 -Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue32397] textwrap output may change if you wrap a paragraph twice

2019-05-18 Thread Cheryl Sabella
Cheryl Sabella added the comment: @larry, it looks like this was close to being merged pending some review comments by Serhiy. Although this is considered a bug and not a new feature, it might be nice to try to get this in for 3.8. Thanks! -- nosy: +cheryl.sabella

[issue32397] textwrap output may change if you wrap a paragraph twice

2018-02-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka type: -> behavior versions: +Python 3.6, Python 3.8 ___ Python tracker

[issue32397] textwrap output may change if you wrap a paragraph twice

2018-02-10 Thread Larry Hastings
Change by Larry Hastings : -- keywords: +patch pull_requests: +5425 stage: -> patch review ___ Python tracker ___

[issue32397] textwrap output may change if you wrap a paragraph twice

2017-12-21 Thread Larry Hastings
Larry Hastings added the comment: FWIW, the test program produces this output: -- original: ' . ' wrapped: ' .\n' wrapped twice: ' . ' Traceback (most

[issue32397] textwrap output may change if you wrap a paragraph twice

2017-12-21 Thread Larry Hastings
New submission from Larry Hastings : If you word-wrap a paragraph twice with textwrap, you may get different results. Specifically, you *will* get different results when: * the original text has a line that is too long by one character, * the last word on the line is the