summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-05-04 01:41:35 +0200
committerhut <hut@lepus.uberspace.de>2015-05-04 01:44:37 +0200
commitfe459089fa965a58a863badbd093cc3fde03e3dc (patch)
treebd92f49d1b8186fb75182e55cfefd8a7c3d1ed99 /ranger
parent806cdaecd4672e58b769f6eb8c372fbfd0dd162a (diff)
downloadranger-fe459089fa965a58a863badbd093cc3fde03e3dc.tar.gz
applied generally useful changes from emacs branch
The 'lt' and 'gt' special keys were added so you can bind actions to
something like "<C-lt>" meaning "Ctrl+<" and <C-gt> 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.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/ext/keybinding_parser.py8
-rw-r--r--ranger/gui/ui.py2
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: