diff options
| author | shadchin <[email protected]> | 2022-04-18 12:39:32 +0300 | 
|---|---|---|
| committer | shadchin <[email protected]> | 2022-04-18 12:39:32 +0300 | 
| commit | d4be68e361f4258cf0848fc70018dfe37a2acc24 (patch) | |
| tree | 153e294cd97ac8b5d7a989612704a0c1f58e8ad4 /contrib/tools/python3/src/Lib/textwrap.py | |
| parent | 260c02f5ccf242d9d9b8a873afaf6588c00237d6 (diff) | |
IGNIETFERRO-1816 Update Python 3 from 3.9.12 to 3.10.4
ref:9f96be6d02ee8044fdd6f124b799b270c20ce641
Diffstat (limited to 'contrib/tools/python3/src/Lib/textwrap.py')
| -rw-r--r-- | contrib/tools/python3/src/Lib/textwrap.py | 12 | 
1 files changed, 10 insertions, 2 deletions
| diff --git a/contrib/tools/python3/src/Lib/textwrap.py b/contrib/tools/python3/src/Lib/textwrap.py index 30e693c8de0..841de9baecf 100644 --- a/contrib/tools/python3/src/Lib/textwrap.py +++ b/contrib/tools/python3/src/Lib/textwrap.py @@ -215,8 +215,16 @@ class TextWrapper:          # If we're allowed to break long words, then do so: put as much          # of the next chunk onto the current line as will fit.          if self.break_long_words: -            cur_line.append(reversed_chunks[-1][:space_left]) -            reversed_chunks[-1] = reversed_chunks[-1][space_left:] +            end = space_left +            chunk = reversed_chunks[-1] +            if self.break_on_hyphens and len(chunk) > space_left: +                # break after last hyphen, but only if there are +                # non-hyphens before it +                hyphen = chunk.rfind('-', 0, space_left) +                if hyphen > 0 and any(c != '-' for c in chunk[:hyphen]): +                    end = hyphen + 1 +            cur_line.append(chunk[:end]) +            reversed_chunks[-1] = chunk[end:]          # Otherwise, we have to preserve the long word intact.  Only add          # it to the current line if there's nothing already there -- | 
