From 3d43517a41dfd568400cffb2e7b480cec315498f Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 13 May 2011 11:46:50 +0200 Subject: =?UTF-8?q?Don=E2=80=99t=20break=20xhtml-im?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/windows.py | 6 +++++- src/xhtml.py | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/windows.py b/src/windows.py index 058f08ce..75b08961 100644 --- a/src/windows.py +++ b/src/windows.py @@ -566,7 +566,11 @@ class TextWin(Win): else: txt = txt.replace('\t', ' ') # length of the time - offset = 9+len(theme.CHAR_TIME_LEFT[:1])+len(theme.CHAR_TIME_RIGHT[:1]) + offset = 9 + if theme.CHAR_TIME_RIGHT: + offset += 1 + if theme.CHAR_TIME_RIGHT: + offset += 1 nickname = message.nickname if nickname and len(nickname) >= 25: nick = nickname[:25]+'…' diff --git a/src/xhtml.py b/src/xhtml.py index d7ad522a..29017be3 100644 --- a/src/xhtml.py +++ b/src/xhtml.py @@ -28,6 +28,7 @@ import subprocess from sleekxmpp.xmlstream import ET from xml.etree.ElementTree import ElementTree from sys import version_info +from string import digits from config import config import logging @@ -133,7 +134,7 @@ def poezio_colors_to_html(string): if 'strong' not in opened_elements: opened_elements.append('strong') res += '' - elif attr_char in string.digits: + elif attr_char in digits: number = int(attr_char) if number in number_to_color_names: if 'strong' in opened_elements: @@ -215,7 +216,7 @@ def poezio_colors_to_xhtml(string): if 'strong' not in open_elements: res += '' open_elements.append('strong') - elif attr_char in string.digits: + elif attr_char in digits: self._win.attron(common.curses_color_pair(int(attr_char))) next_attr_char = string.find('\x19') -- cgit v1.2.3