summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-12 19:30:25 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-12 19:30:25 +0000
commit52c8cdb5ceb42f158d2eebbc3339ecbcb3ed523f (patch)
tree3c88cad840e3fa8277376e6b0cc2a86ed2a223c6 /src
parent94fcfd07929b38218e1abb3bd81ae2db76edf013 (diff)
downloadpoezio-52c8cdb5ceb42f158d2eebbc3339ecbcb3ed523f.tar.gz
poezio-52c8cdb5ceb42f158d2eebbc3339ecbcb3ed523f.tar.bz2
poezio-52c8cdb5ceb42f158d2eebbc3339ecbcb3ed523f.tar.xz
poezio-52c8cdb5ceb42f158d2eebbc3339ecbcb3ed523f.zip
don't crash on very big nickname
Diffstat (limited to 'src')
-rw-r--r--src/window.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/window.py b/src/window.py
index 9eace955..6b6ad8db 100644
--- a/src/window.py
+++ b/src/window.py
@@ -187,8 +187,12 @@ class TextWin(Win):
for message in messages:
txt = message.txt
offset = 11 # length of the time
- if message.nickname:
- offset += len(message.nickname) + 2 # + nick + spaces length
+ if message.nickname and len(message.nickname) >= 30:
+ nick = message.nickname[:30]+u'…'
+ else:
+ nick = message.nickname
+ if nick:
+ offset += len(nick) + 2 # + nick + spaces length
first = True
while txt != '':
# debug(txt)
@@ -198,7 +202,7 @@ class TextWin(Win):
else:
limit = self.width-offset-1
if first and message.user:
- line = Line(message.nickname, message.user.color,
+ line = Line(nick, message.user.color,
message.time,
txt[:limit], message.color,
offset)
@@ -651,7 +655,7 @@ class Window(object):
Resize the whole tabe. i.e. all its sub-windows
"""
self.size = (self.height, self.width) = stdscr.getmaxyx()
- if self.height < 10 or self.width < 60:
+ if self.height < 10 or self.width < 50:
visible = False
else:
visible = True