summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-09-27 19:48:28 +0200
committermathieui <mathieui@mathieui.net>2012-09-27 19:48:28 +0200
commite480d8418ab396bddabebca1802c9bcf443e07b4 (patch)
tree18e6f13b028fd5b6cf63a26ff3b43e59e8f0f663 /src
parent020e6478e38630fa6629b4d62aa4d5ae157424f8 (diff)
downloadpoezio-e480d8418ab396bddabebca1802c9bcf443e07b4.tar.gz
poezio-e480d8418ab396bddabebca1802c9bcf443e07b4.tar.bz2
poezio-e480d8418ab396bddabebca1802c9bcf443e07b4.tar.xz
poezio-e480d8418ab396bddabebca1802c9bcf443e07b4.zip
Prevent special keys to appear in the input when lagging
Diffstat (limited to 'src')
-rw-r--r--src/core.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core.py b/src/core.py
index f3a0046e..2accb4c4 100644
--- a/src/core.py
+++ b/src/core.py
@@ -354,14 +354,19 @@ class Core(object):
"""
main loop waiting for the user to press a key
"""
- def replace_line_breaks(key):
+ def sanitize_input(key):
if key == '^J':
return '\n'
- return key
- def replace_tabulation(key):
- if key == '^I':
+ elif key == '^I':
return ' '
+ elif len(key) > 1:
+ return ''
return key
+ def replace_line_breaks(key):
+ if key == '^J':
+ return '\n'
+ return key
+
while self.running:
if self.paused: continue
char_list = [common.replace_key_with_bound(key)\
@@ -393,7 +398,7 @@ class Core(object):
self.refresh_window()
else:
self.do_command(''.join(map(
- lambda x: replace_line_breaks(replace_tabulation(x)),
+ lambda x: sanitize_input(x),
char_list)
), True)
self.refresh_window()