diff options
author | Florent Le Coz <louiz@louiz.org> | 2012-10-09 06:00:43 +0000 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2012-10-09 06:00:43 +0000 |
commit | b50acaae0b4499aec0d06f91739d23e6aa212156 (patch) | |
tree | 3569ee25769679ef871b0a39a870d049bae7b27c /src/core.py | |
parent | c9a244ceb02ae0fe6710ddb08f573deb6b0bbd3b (diff) | |
download | poezio-b50acaae0b4499aec0d06f91739d23e6aa212156.tar.gz poezio-b50acaae0b4499aec0d06f91739d23e6aa212156.tar.bz2 poezio-b50acaae0b4499aec0d06f91739d23e6aa212156.tar.xz poezio-b50acaae0b4499aec0d06f91739d23e6aa212156.zip |
Send a real \t when pasting a text containing tabs.
Diffstat (limited to 'src/core.py')
-rw-r--r-- | src/core.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/core.py b/src/core.py index 4e7cb297..439fa219 100644 --- a/src/core.py +++ b/src/core.py @@ -354,10 +354,6 @@ class Core(object): """ main loop waiting for the user to press a key """ - def sanitize_input(key): - if key == '^I': - return ' ' - return key def replace_line_breaks(key): if key == '^J': return '\n' @@ -383,9 +379,16 @@ class Core(object): if len(char) == 1: current.append(char) else: - res.append(current) + # special case for the ^I key, it’s considered as \t + # only when pasting some text, otherwise that’s the ^I + # (or M-i) key, which stands for completion by default. + if char == '^I' and len(char_list) != 1: + current.append('\t') + continue + if current: + res.append(current) + current = [] res.append([char]) - current = [] if current: res.append(current) return res @@ -393,8 +396,6 @@ class Core(object): if self.paused: continue big_char_list = [common.replace_key_with_bound(key)\ for key in self.read_keyboard()] - log.debug(big_char_list) - log.debug(separate_chars_from_bindings(big_char_list)) # whether to refresh after ALL keys have been handled for char_list in separate_chars_from_bindings(big_char_list): if self.paused: @@ -421,10 +422,7 @@ class Core(object): else: res = self.do_command(replace_line_breaks(char), False) else: - self.do_command(''.join(map( - lambda x: sanitize_input(x), - char_list) - ), True) + self.do_command(''.join(char_list), True) self.doupdate() def save_config(self): |