summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-03-30 04:34:45 +0200
committerFlorent Le Coz <louiz@louiz.org>2011-03-30 04:34:45 +0200
commit92e63829a699ec68e7dcc2185fb7393255342dd2 (patch)
treea7a217287d8124af9c4c9ecfed54d380c282da8f /src/windows.py
parent51cebe7bdc24fbeecd6b4ed0bd87760b84a2ef3b (diff)
downloadpoezio-92e63829a699ec68e7dcc2185fb7393255342dd2.tar.gz
poezio-92e63829a699ec68e7dcc2185fb7393255342dd2.tar.bz2
poezio-92e63829a699ec68e7dcc2185fb7393255342dd2.tar.xz
poezio-92e63829a699ec68e7dcc2185fb7393255342dd2.zip
Finish colors support with xhtml (clean the elinks dump, handle the input etc)
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/windows.py b/src/windows.py
index 7051bf2d..48cfc7ba 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -1103,7 +1103,8 @@ class MessageInput(Input):
"""
attr_char = read_char(self.core.stdscr)
if attr_char in self.text_attributes or attr_char.isdigit():
- self.do_command('\x19%s' % attr_char)
+ self.do_command('\x19', False)
+ self.do_command(attr_char)
def key_down(self):
"""
@@ -1131,6 +1132,23 @@ class MessageInput(Input):
self.clear_text()
return txt
+ def rewrite_text(self):
+ """
+ Refresh the line onscreen, from the pos and pos_line, with colors
+ """
+ with g_lock:
+ text = self.text.replace('\n', '|')
+ self._win.erase()
+ if self.color:
+ self._win.attron(common.curses_color_pair(self.color))
+ displayed_text = text[self.line_pos:self.line_pos+self.width-1]
+ self._win.attrset(0)
+ self.addstr_colored(displayed_text)
+ self.addstr(0, wcwidth.wcswidth(displayed_text[:self.pos]), '')
+ if self.color:
+ self._win.attroff(common.curses_color_pair(self.color))
+ self._refresh()
+
class CommandInput(Input):
"""
An input with an help message in the left, with three given callbacks: