From fe459089fa965a58a863badbd093cc3fde03e3dc Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 4 May 2015 01:41:35 +0200 Subject: applied generally useful changes from emacs branch The 'lt' and 'gt' special keys were added so you can bind actions to something like "" meaning "Ctrl+<" and meaning "Ctrl+>". "key > 0" was changed to "key >= 0" in ranger.gui.ui so that Ctrl+Space (which has the key value 0) can be recognized. I am not 100% sure if this has side effects. --- ranger/ext/keybinding_parser.py | 8 ++++++-- ranger/gui/ui.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py index 780359f5..8efb337f 100644 --- a/ranger/ext/keybinding_parser.py +++ b/ranger/ext/keybinding_parser.py @@ -34,6 +34,8 @@ special_keys = { 'end': curses.KEY_END, 'tab': ord('\t'), 's-tab': curses.KEY_BTAB, + 'lt': ord('<'), + 'gt': ord('>'), } very_special_keys = { @@ -46,12 +48,14 @@ very_special_keys = { for key, val in tuple(special_keys.items()): special_keys['a-' + key] = (ALT_KEY, val) -for char in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789': +for char in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_!{}': special_keys['a-' + char] = (ALT_KEY, ord(char)) -for char in 'abcdefghijklmnopqrstuvwxyz': +for char in 'abcdefghijklmnopqrstuvwxyz_': special_keys['c-' + char] = ord(char) - 96 +special_keys['c-space'] = 0 + for n in range(64): special_keys['f' + str(n)] = curses.KEY_F0 + n diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 1d125acf..b006e671 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -199,7 +199,7 @@ class UI(DisplayableContainer): curses.flushinp() else: # Handle simple key presses, CTRL+X, etc here: - if key > 0: + if key >= 0: if self.settings.flushinput and not self.console.visible: curses.flushinp() if key == curses.KEY_MOUSE: -- cgit 1.4.1-2-gfad0