summaryrefslogtreecommitdiff
path: root/Lib/textwrap.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2004-06-03 01:59:41 +0000
committerGreg Ward <gward@python.net>2004-06-03 01:59:41 +0000
commit6186410db06f28b3032a882d5ba7a2e3dcf95a80 (patch)
tree9ddf7a949974f652fe6012007d0650312634b51b /Lib/textwrap.py
parent29eb8c315d23fd6a36a22be50ad4c1a229f94342 (diff)
downloadcpython-git-6186410db06f28b3032a882d5ba7a2e3dcf95a80.tar.gz
SF #965425: fix so hyphenated words surrounded by punctuation are
wrapped correctly.
Diffstat (limited to 'Lib/textwrap.py')
-rw-r--r--Lib/textwrap.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/textwrap.py b/Lib/textwrap.py
index d9df01928c..32ab10bfba 100644
--- a/Lib/textwrap.py
+++ b/Lib/textwrap.py
@@ -79,11 +79,11 @@ 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'[^\s\w]*\w{2,}-(?=\w{2,})|' # hyphenated words
r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash
- # XXX will there be a locale-or-charset-aware version of
- # string.lowercase in 2.3?
+ # XXX this is not locale- or charset-aware -- string.lowercase
+ # is US-ASCII only (and therefore English-only)
sentence_end_re = re.compile(r'[%s]' # lowercase letter
r'[\.\!\?]' # sentence-ending punct.
r'[\"\']?' # optional end-of-quote