From: Greg Ward Date: Thu, 22 Aug 2002 21:04:21 +0000 (+0000) Subject: Fix SF bug #596434: tweak wordsep_re so "--foo-bar" now splits X-Git-Tag: v2.3c1~4340 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cce4d67fc466b902a6b553c731d7be700b506dfd;p=thirdparty%2FPython%2Fcpython.git Fix SF bug #596434: tweak wordsep_re so "--foo-bar" now splits into /--foo-/bar/ rather than /--/foo-/bar/. Needed for Optik and Docutils to handle Unix-style command-line options properly. --- diff --git a/Lib/textwrap.py b/Lib/textwrap.py index fb8d3b841d43..8b3a26559a57 100644 --- a/Lib/textwrap.py +++ b/Lib/textwrap.py @@ -55,7 +55,7 @@ class TextWrapper: # Hello/ /there/ /--/ /you/ /goof-/ball,/ /use/ /the/ /-b/ /option! # (after stripping out empty strings). wordsep_re = re.compile(r'(\s+|' # any whitespace - r'\w{2,}-(?=\w{2,})|' # hyphenated words + r'-*\w{2,}-(?=\w{2,})|' # hyphenated words r'(?<=\w)-{2,}(?=\w))') # em-dash # XXX will there be a locale-or-charset-aware version of