mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Fix an endcase bug: initial_indent was ignored when the text was short
enough to fit in one line.
This commit is contained in:
parent
fb4d6ecd07
commit
eb287a2662
2 changed files with 16 additions and 5 deletions
|
|
@ -237,8 +237,9 @@ class TextWrapper:
|
|||
converted to space.
|
||||
"""
|
||||
text = self._munge_whitespace(text)
|
||||
if len(text) <= self.width:
|
||||
return [text]
|
||||
indent = self.initial_indent
|
||||
if len(text) + len(indent) <= self.width:
|
||||
return [indent + text]
|
||||
chunks = self._split(text)
|
||||
if self.fix_sentence_endings:
|
||||
self._fix_sentence_endings(chunks)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue