Made wrap_string carry format strings over to the next line

This commit is contained in:
Asmageddon 2012-07-12 15:59:50 +02:00
parent 33e5cad75a
commit d9a2597617
1 changed files with 10 additions and 0 deletions

View File

@ -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