[Python-checkins] python/dist/src/Lib textwrap.py,1.15,1.16

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Wed, 02 Oct 2002 08:47:07 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv26720

Modified Files:
	textwrap.py 
Log Message:
Fix an endcase bug: initial_indent was ignored when the text was short
enough to fit in one line.


Index: textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** textwrap.py	22 Aug 2002 21:28:00 -0000	1.15
--- textwrap.py	2 Oct 2002 15:47:05 -0000	1.16
***************
*** 238,243 ****
          """
          text = self._munge_whitespace(text)
!         if len(text) <= self.width:
!             return [text]
          chunks = self._split(text)
          if self.fix_sentence_endings:
--- 238,244 ----
          """
          text = self._munge_whitespace(text)
!         indent = self.initial_indent
!         if len(text) + len(indent) <= self.width:
!             return [indent + text]
          chunks = self._split(text)
          if self.fix_sentence_endings: