summaryrefslogtreecommitdiff
path: root/src/window.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-12 22:33:01 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-12 22:33:01 +0000
commit3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16 (patch)
treeed0212dd41c327e317f9600eb0fca4819ad64661 /src/window.py
parent981e12a669424d5685e11104ad03b82a2aac05cd (diff)
downloadpoezio-3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16.tar.gz
poezio-3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16.tar.bz2
poezio-3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16.tar.xz
poezio-3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16.zip
fix an infinie loop on empty line, and the bug with the history message said by a nickname not present anymore
Diffstat (limited to 'src/window.py')
-rw-r--r--src/window.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/window.py b/src/window.py
index 6334fb2c..e981c04e 100644
--- a/src/window.py
+++ b/src/window.py
@@ -184,6 +184,7 @@ class TextWin(Win):
for message in messages:
txt = message.txt
offset = 11 # length of the time
+ debug(str(message.nickname) + ' : '+message.txt + '\n')
if message.nickname and len(message.nickname) >= 30:
nick = message.nickname[:30]+u'…'
else:
@@ -198,17 +199,14 @@ class TextWin(Win):
# debug("=================="+str(limit))
else:
limit = self.width-offset-1
- if first and message.user:
- line = Line(nick, message.user.color,
- message.time,
- txt[:limit], message.color,
- offset)
- else:
- line = Line(None, None,
- message.time,
- txt[:limit], message.color,
- offset)
- lines.append(line)
+ if limit == 0:
+ break
+ color = message.user.color if message.user else None
+ l = Line(nick, color,
+ message.time,
+ txt[:limit], message.color,
+ offset)
+ lines.append(l)
txt = txt[limit:]
first = False
return lines[-len(messages):]# return only the needed number of lines
@@ -271,9 +269,11 @@ class TextWin(Win):
Write the nickname, using the user's color
and return the number of written characters
"""
- self.win.attron(curses.color_pair(color))
+ if color:
+ self.win.attron(curses.color_pair(color))
self.win.addstr(nickname)
- self.win.attroff(curses.color_pair(color))
+ if color:
+ self.win.attroff(curses.color_pair(color))
self.win.addnstr("> ", 2)
def write_time(self, time):