From 6781f67e80aa5ec86c84b49ef4526dcef9feceda Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 11 Nov 2012 16:01:53 +0100 Subject: =?UTF-8?q?Preload=20history=20into=20discussion=20windows=20(?= =?UTF-8?q?=C3=A0=20la=20mcabber)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 for the original code --- src/windows.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/windows.py') 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) -- cgit v1.2.3