summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-03-29 21:07:53 +0200
committerFlorent Le Coz <louiz@louiz.org>2011-03-29 21:07:53 +0200
commit51cebe7bdc24fbeecd6b4ed0bd87760b84a2ef3b (patch)
tree7dcf3a431daaeb200dba00ea6d33c8068d2b0202 /src/windows.py
parent42f4d555125ef3616e630b3e502285c496d382fc (diff)
downloadpoezio-51cebe7bdc24fbeecd6b4ed0bd87760b84a2ef3b.tar.gz
poezio-51cebe7bdc24fbeecd6b4ed0bd87760b84a2ef3b.tar.bz2
poezio-51cebe7bdc24fbeecd6b4ed0bd87760b84a2ef3b.tar.xz
poezio-51cebe7bdc24fbeecd6b4ed0bd87760b84a2ef3b.zip
Remove the xhtml-im that was inserted for debug, add the start of a method to enter attributes in Inputs, convert \n to <br /> in xhtml_im bodies and put that body in a <p> element
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/windows.py b/src/windows.py
index cecd9b0d..7051bf2d 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -50,6 +50,8 @@ import wcwidth
import singleton
import collections
+from keyboard import read_char
+
Line = collections.namedtuple('Line', 'text text_offset nickname_color time nickname')
g_lock = Lock()
@@ -1065,8 +1067,10 @@ class MessageInput(Input):
"""
The input featuring history and that is being used in
Conversation, Muc and Private tabs
+ Also letting the user enter colors or other text markups
"""
history = list() # The history is common to all MessageInput
+ text_attributes = set(('b', 'o', 'u'))
def __init__(self):
Input.__init__(self)
@@ -1076,6 +1080,7 @@ class MessageInput(Input):
self.key_func["M-A"] = self.key_up
self.key_func["KEY_DOWN"] = self.key_down
self.key_func["M-B"] = self.key_down
+ self.key_func['^C'] = self.enter_attrib
def key_up(self):
"""
@@ -1092,6 +1097,14 @@ class MessageInput(Input):
self.text = MessageInput.history[self.histo_pos]
self.key_end()
+ def enter_attrib(self):
+ """
+ Read one more char (c) and add \x19c to the string
+ """
+ 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)
+
def key_down(self):
"""
Get the next line in the history