diff --git a/src/ircutils.py b/src/ircutils.py index 75bb4c9c3..f6741beda 100644 --- a/src/ircutils.py +++ b/src/ircutils.py @@ -436,9 +436,12 @@ class FormatParser(object): else: self.ungetChar(c) -def wrap(s, length): +def wrap(s, length, break_on_hyphens = False, break_long_words = False): processed = [] - chunks = textwrap.wrap(s, length) + wrapper = textwrap.TextWrapper(width=length) + wrapper.break_long_words = break_long_words + wrapper.break_on_hyphens = break_on_hyphens + chunks = wrapper.wrap(s) context = None for chunk in chunks: if context is not None: