mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fix SF bug #622849: in _wrap_chunks(), ensure that leading whitespace in
the input string is always preserved.
This commit is contained in:
parent
2e74541d7e
commit
ab73d46e45
1 changed files with 3 additions and 2 deletions
|
@ -202,8 +202,9 @@ class TextWrapper:
|
||||||
# Maximum width for this line.
|
# Maximum width for this line.
|
||||||
width = self.width - len(indent)
|
width = self.width - len(indent)
|
||||||
|
|
||||||
# First chunk on line is whitespace -- drop it.
|
# First chunk on line is whitespace -- drop it, unless this
|
||||||
if chunks[0].strip() == '':
|
# is the very beginning of the text (ie. no lines started yet).
|
||||||
|
if chunks[0].strip() == '' and lines:
|
||||||
del chunks[0]
|
del chunks[0]
|
||||||
|
|
||||||
while chunks:
|
while chunks:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue