summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-03-09 12:40:51 +0100
committerhut <hut@lavabit.com>2010-03-09 14:40:24 +0100
commitefbde17048b14d43895e4cf91e798fb97702b68f (patch)
treee3abf4aea43ac6d615003534c3e152278cb17b65 /ranger
parent4a435286452a8a0177994a6f27f3806cdb74fa82 (diff)
downloadranger-efbde17048b14d43895e4cf91e798fb97702b68f.tar.gz
keyparser: test for collisions with directories of a lenght > 1
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/keymap.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/ranger/container/keymap.py b/ranger/container/keymap.py
index 7f72a282..e8cf6119 100644
--- a/ranger/container/keymap.py
+++ b/ranger/container/keymap.py
@@ -115,7 +115,7 @@ class KeyBuffer(object):
 	"""The evaluator and storage for pressed keys"""
 	def __init__(self, keymap, direction_keys):
 		self.assign(keymap, direction_keys)
-	
+
 	def assign(self, keymap, direction_keys):
 		self.keymap = keymap
 		self.direction_keys = direction_keys
@@ -210,20 +210,23 @@ class KeyBuffer(object):
 			self.failure = True
 			return None
 		except KeyError:
-			if DIRKEY in self.tree_pointer:
-				self.eval_command = False
-				self.eval_quantifier = True
+			try:
 				self.tree_pointer = self.tree_pointer[DIRKEY]
+			except KeyError:
+				try:
+					self.tree_pointer = self.tree_pointer[ANYKEY]
+				except KeyError:
+					self.failure = True
+					return None
+				else:
+					self.matches.append(key)
+					assert isinstance(self.tree_pointer, (Binding, dict))
+					self._try_to_finish()
+			else:
 				assert isinstance(self.tree_pointer, (Binding, dict))
+				self.eval_command = False
+				self.eval_quantifier = True
 				self.dir_tree_pointer = self.direction_keys._tree
-			elif ANYKEY in self.tree_pointer:
-				self.matches.append(key)
-				self.tree_pointer = self.tree_pointer[ANYKEY]
-				assert isinstance(self.tree_pointer, (Binding, dict))
-				self._try_to_finish()
-			else:
-				self.failure = True
-				return None
 		else:
 			if isinstance(self.tree_pointer, dict):
 				try:
@@ -286,7 +289,6 @@ special_keys = {
 	'cr': ord("\n"),
 	'enter': ord("\n"),
 	'space': ord(" "),
-	'space': ord(" "),
 	'down': curses.KEY_DOWN,
 	'up': curses.KEY_UP,
 	'left': curses.KEY_LEFT,