Keep one bool LESS in each line, YAY, that’s HUGE.

This commit is contained in:
Florent Le Coz 2011-09-13 01:59:50 +02:00
parent c8d80807c7
commit b33a09f0f6

View file

@ -45,7 +45,7 @@ import collections
# msg is a reference to the corresponding Message tuple. text_start and text_end are the position # msg is a reference to the corresponding Message tuple. text_start and text_end are the position
# delimiting the text in this line. # delimiting the text in this line.
# first is a bool telling if this is the first line of the message. # first is a bool telling if this is the first line of the message.
Line = collections.namedtuple('Line', 'msg start_pos end_pos first') Line = collections.namedtuple('Line', 'msg start_pos end_pos')
g_lock = Lock() g_lock = Lock()
@ -567,13 +567,10 @@ class TextWin(Win):
if theme.CHAR_TIME_RIGHT: if theme.CHAR_TIME_RIGHT:
offset += 1 offset += 1
lines = cut_text(txt, self.width-offset) lines = cut_text(txt, self.width-offset)
first = True
for line in lines: for line in lines:
self.built_lines.append(Line(msg=message, self.built_lines.append(Line(msg=message,
start_pos=line[0], start_pos=line[0],
end_pos=line[1], end_pos=line[1]))
first=first))
first = False
if clean: if clean:
while len(self.built_lines) > self.lines_nb_limit: while len(self.built_lines) > self.lines_nb_limit:
self.built_lines.pop(0) self.built_lines.pop(0)
@ -595,7 +592,7 @@ class TextWin(Win):
self.write_line_separator() self.write_line_separator()
else: else:
msg = line.msg msg = line.msg
if line.first: if line.start_pos == 0:
if msg.nick_color: if msg.nick_color:
color = msg.nick_color color = msg.nick_color
elif msg.user: elif msg.user: