diff browser_side/panels.py @ 174:d97b0cba8b04

browser side: fix the line jump in unibox after entering something (work around a pyjamas bug)
author Goffi <goffi@goffi.org>
date Sun, 13 Jan 2013 22:26:16 +0100
parents 9441893e8f37
children ba95cd824e06
line wrap: on
line diff
--- a/browser_side/panels.py	Sun Jan 13 20:30:42 2013 +0100
+++ b/browser_side/panels.py	Sun Jan 13 22:26:16 2013 +0100
@@ -443,6 +443,13 @@
             type = "UNKNOWN"
         return (type, target)
 
+    def onBrowserEvent(self, event):
+        #XXX: woraroung a pyjamas bug: self.currentEvent is not set
+        #     so the TextBox's cancelKey doens't work. This is a workaround
+        #     FIXME: fix the bug upstream
+        self.currentEvent = event
+        TextArea.onBrowserEvent(self, event)
+
     def onKeyPress(self, sender, keycode, modifiers):
         _txt = self.getText()
         if not self._popup:
@@ -468,6 +475,7 @@
                     self.host.bridge.call('sendMessage', None, str(_chat.target), _txt, '', mess_type)
             self.setText('')
             self._timeCb(None) #we remove the popup
+            sender.cancelKey()
 
     """def complete(self):