From 169392e519e157830ba7ab8547eb84a3d164d73f Mon Sep 17 00:00:00 2001 From: Guido Tabbernuk Date: Tue, 24 Jul 2012 11:11:16 +0300 Subject: [PATCH] Messages shouldn't wrap links, set defaults for text wrapper. --- src/ircutils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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: