diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-11-18 19:14:07 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-11-18 19:14:07 +0100 |
commit | 7dd8691f8c0193aa6f635374ececa8d3465a943a (patch) | |
tree | e2ece5b355281b7a56cc09fc95edcaf8e5941ef7 /src/core.py | |
parent | 18dbc880e1d72a09caec8163de4f80bf03f567e1 (diff) | |
download | poezio-7dd8691f8c0193aa6f635374ececa8d3465a943a.tar.gz poezio-7dd8691f8c0193aa6f635374ececa8d3465a943a.tar.bz2 poezio-7dd8691f8c0193aa6f635374ececa8d3465a943a.tar.xz poezio-7dd8691f8c0193aa6f635374ececa8d3465a943a.zip |
Pasting text is now handled has one single big key.
This avoids looping over each char we are pasting, making it
a lot faster (actually, should be instant).
Diffstat (limited to 'src/core.py')
-rw-r--r-- | src/core.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core.py b/src/core.py index 8de694f7..b2fde79d 100644 --- a/src/core.py +++ b/src/core.py @@ -787,7 +787,10 @@ class Core(object): """ main loop waiting for the user to press a key """ - # curses.ungetch(0) # FIXME + def replace_line_breaks(key): + if key == '^J': + return '\n' + return key while self.running: char_list = [common.replace_key_with_bound(key)\ for key in self.read_keyboard()] @@ -812,8 +815,7 @@ class Core(object): if res: self.refresh_window() else: - for char in char_list: - self.do_command(char, True) + self.do_command(''.join(list(map(replace_line_breaks, char_list))), True) self.refresh_window() self.doupdate() |