]> granicus.if.org Git - python/commitdiff
Fix SF bug #596434: tweak wordsep_re so "--foo-bar" now splits
authorGreg Ward <gward@python.net>
Thu, 22 Aug 2002 21:04:21 +0000 (21:04 +0000)
committerGreg Ward <gward@python.net>
Thu, 22 Aug 2002 21:04:21 +0000 (21:04 +0000)
into /--foo-/bar/ rather than /--/foo-/bar/.  Needed for Optik and
Docutils to handle Unix-style command-line options properly.

Lib/textwrap.py

index fb8d3b841d438e92678375b52a0143211f2b70e1..8b3a26559a57487771ed250aedb4d378821054c6 100644 (file)
@@ -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