summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-03-29 14:35:59 +0200
committerFlorent Le Coz <louiz@louiz.org>2011-03-29 14:35:59 +0200
commit38cffe43b6adab115fb65635034a0b2db9f2c26d (patch)
treeb45e751374b8e0da8bf4046ae8c555d1b0cf5cee /src
parent8b032a6ece601c74ea0d9cf4f0c7a3e1ae72bcb2 (diff)
downloadpoezio-38cffe43b6adab115fb65635034a0b2db9f2c26d.tar.gz
poezio-38cffe43b6adab115fb65635034a0b2db9f2c26d.tar.bz2
poezio-38cffe43b6adab115fb65635034a0b2db9f2c26d.tar.xz
poezio-38cffe43b6adab115fb65635034a0b2db9f2c26d.zip
Message and complete words can now be colored even if the
take more than one line to be displayed.
Diffstat (limited to 'src')
-rw-r--r--src/room.py2
-rw-r--r--src/text_buffer.py2
-rw-r--r--src/windows.py11
3 files changed, 10 insertions, 5 deletions
diff --git a/src/room.py b/src/room.py
index ace0ee44..7d649ac4 100644
--- a/src/room.py
+++ b/src/room.py
@@ -112,7 +112,7 @@ class Room(TextBuffer):
if highlight:
nick_color = highlight
time = time or datetime.now()
- message = Message(txt=txt, nick_color=nick_color,
+ message = Message(txt='%s\x19o'%(txt,), nick_color=nick_color,
time=time, nickname=nickname, user=user)
while len(self.messages) > self.messages_nb_limit:
self.messages.pop(0)
diff --git a/src/text_buffer.py b/src/text_buffer.py
index 1c112222..a53eedf6 100644
--- a/src/text_buffer.py
+++ b/src/text_buffer.py
@@ -48,7 +48,7 @@ class TextBuffer(object):
if not nickname:
txt = '\x195%s' % (txt,)
nick_color = nick_color
- msg = Message(txt=txt, nick_color=nick_color,
+ msg = Message(txt='%s\x19o'%(txt,), nick_color=nick_color,
time=time or datetime.now(), nickname=nickname, user=None)
self.messages.append(msg)
while len(self.messages) > self.messages_nb_limit:
diff --git a/src/windows.py b/src/windows.py
index eaa8da68..cecd9b0d 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -112,7 +112,6 @@ class Win(object):
if y is not None and x is not None:
self._win.move(y, x)
next_attr_char = string.find('\x19')
- self._win.attrset(0) # reset all attr
while next_attr_char != -1:
attr_char = string[next_attr_char+1].lower()
if next_attr_char != 0:
@@ -128,7 +127,6 @@ class Win(object):
self._win.attron(common.curses_color_pair(int(attr_char)))
next_attr_char = string.find('\x19')
self.addstr(string)
- self._win.attrset(0)
def finish_line(self, color):
"""
@@ -608,9 +606,16 @@ class TextWin(Win):
else:
self.write_time(line.time)
self.write_nickname(line.nickname, line.nickname_color)
- self.write_text(y, line.text_offset, line.text)
if y != self.height-1:
self.addstr('\n')
+ self._win.attrset(0)
+ for y, line in enumerate(lines):
+ if not line:
+ continue
+ self.write_text(y, line.text_offset, line.text)
+ if y != self.height-1:
+ self.addstr('\n')
+ self._win.attrset(0)
self._refresh()
def write_line_separator(self):