This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients
Date 2007-04-19.06:37:03
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
FWIW, one workaround is to "monkey patch" the module:

  textwrap.TextWrapper.wordsep_re = re.compile(r'(\s+|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))')

Another workaround is to "hide" the hyphens during wrapping and then restore them.
  
  def myfill(text, width=70, **kwargs):
     althyphen = chr(127)
     text = text.replace('-', althyphen)
     result = wrap(text, width, **kwargs)
     return result.replace(althyphen, '-')

That being said, I'm +1 on adding a keyword argument treating hyphens as non-breaking.
History
Date User Action Args
2007-08-23 16:12:43adminlinkissue1702681 messages
2007-08-23 16:12:43admincreate