summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-11-11 16:01:53 +0100
committermathieui <mathieui@mathieui.net>2012-11-11 16:01:53 +0100
commit6781f67e80aa5ec86c84b49ef4526dcef9feceda (patch)
tree03b86fbcf9cc34fb8412558fec4e3c19c78a268d /src/windows.py
parent844392a69aad39b37281f212b0a55c8a611575ac (diff)
downloadpoezio-6781f67e80aa5ec86c84b49ef4526dcef9feceda.tar.gz
poezio-6781f67e80aa5ec86c84b49ef4526dcef9feceda.tar.bz2
poezio-6781f67e80aa5ec86c84b49ef4526dcef9feceda.tar.xz
poezio-6781f67e80aa5ec86c84b49ef4526dcef9feceda.zip
Preload history into discussion windows (à la mcabber)
- New option load_log defaulting to 200 to indicate the number of lines to be loaded - It’s still very raw, and the format of the message does not match the format of the normal room history, for example - Works in the Private chat, MUC, and Conversation tabs Thanks to labedz <github@labedz.org> for the original code
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/windows.py b/src/windows.py
index 5c1dc27b..589f808c 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -776,12 +776,14 @@ class TextWin(Win):
if not txt:
return 0
nick = truncate_nick(message.nickname)
- offset = 1 + len(message.str_time)
+ offset = 0
+ if message.str_time:
+ offset += 1 + len(message.str_time)
if nick:
offset += wcwidth.wcswidth(nick) + 2 # + nick + spaces length
- if get_theme().CHAR_TIME_LEFT:
+ if get_theme().CHAR_TIME_LEFT and message.str_time:
offset += 1
- if get_theme().CHAR_TIME_RIGHT:
+ if get_theme().CHAR_TIME_RIGHT and message.str_time:
offset += 1
lines = cut_text(txt, self.width-offset)
if self.lock:
@@ -832,7 +834,9 @@ class TextWin(Win):
if not line:
self.write_line_separator(y)
else:
- self.write_text(y, (3 if line.msg.nickname else 1) + len(line.msg.str_time)+len(truncate_nick(line.msg.nickname) or ''), line.msg.txt[line.start_pos:line.end_pos])
+ self.write_text(y,
+ (3 if line.msg.nickname else (1 if line.msg.str_time else 0)) + len(line.msg.str_time)+len(truncate_nick(line.msg.nickname) or ''),
+ line.msg.txt[line.start_pos:line.end_pos])
if y != self.height-1:
self.addstr('\n')
self._win.attrset(0)