From d9a2597617ba92900c6b298f53d69b40959c17e9 Mon Sep 17 00:00:00 2001 From: Asmageddon Date: Thu, 12 Jul 2012 15:59:50 +0200 Subject: [PATCH] Made wrap_string carry format strings over to the next line --- deluge/ui/console/modes/format_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/deluge/ui/console/modes/format_utils.py b/deluge/ui/console/modes/format_utils.py index 58f3c495e..bf218c9ec 100644 --- a/deluge/ui/console/modes/format_utils.py +++ b/deluge/ui/console/modes/format_utils.py @@ -203,6 +203,16 @@ def wrap_string(string,width,min_lines=0,strip_colors=True): for i in range(len(ret),min_lines): ret.append(" ") + #Carry colors over to the next line + last_color_string = "" + for i, line in enumerate(ret): + if i != 0: + ret[i] = "%s%s" % (last_color_string, ret[i]) + + colors = re.findall("\\{![^!]+!\\}", line) + if colors: + last_color_string = colors[-1] + return ret from unicodedata import east_asian_width