diff Lib/textwrap.py @ 25534:08148e916d38 legacy-trunk

Fix an endcase bug: initial_indent was ignored when the text was short enough to fit in one line.
author Guido van Rossum <guido@python.org>
date Wed, 02 Oct 2002 15:47:32 +0000
parents f6581299bc03
children 0838c4247917
line wrap: on
line diff
--- a/Lib/textwrap.py	Wed Oct 02 13:13:45 2002 +0000
+++ b/Lib/textwrap.py	Wed Oct 02 15:47:32 2002 +0000
@@ -237,8 +237,9 @@
         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)