about summary refs log tree commit diff stats
path: root/ranger/container/keymap.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-02-24 12:42:21 +0100
committerhut <hut@lavabit.com>2010-03-09 14:40:23 +0100
commit4070e6c93a9e24a5c1bb919668e3124fbd3161de (patch)
tree48fc43aa877a104548497783c867c7d06203c187 /ranger/container/keymap.py
parent09d8404c62454a08dffc99d0a79d46ac51d8aab5 (diff)
downloadranger-4070e6c93a9e24a5c1bb919668e3124fbd3161de.tar.gz
keyparser: stuff
Diffstat (limited to 'ranger/container/keymap.py')
-rw-r--r--ranger/container/keymap.py27
1 files changed, 7 insertions, 20 deletions
diff --git a/ranger/container/keymap.py b/ranger/container/keymap.py
index f9be5e95..50b70b33 100644
--- a/ranger/container/keymap.py
+++ b/ranger/container/keymap.py
@@ -16,6 +16,7 @@ import curses
 from string import ascii_lowercase
 from inspect import isfunction, getargspec
 from ranger.ext.tree import Tree
+from ranger.ext.direction import Direction
 
 MAX_ALIAS_RECURSION = 20
 PASSIVE_ACTION = 9003
@@ -26,25 +27,6 @@ DIRECTION = 'direction'
 DIRARG = 'dir'
 ALIASARG = 'alias'
 
-class Direction(object):
-	"""An object with a down and right method"""
-	def __init__(self, down=0, right=0):
-		self.down = down
-		self.right = right
-
-	def copy(self):
-		new = type(self)()
-		new.__dict__.update(self.__dict__)
-		return new
-
-	def __mul__(self, other):
-		copy = self.copy()
-		if other is not None:
-			copy.down *= other
-			copy.right *= other
-		return copy
-	__rmul__ = __mul__
-
 def to_string(i):
 	"""convert a ord'd integer to a string"""
 	try:
@@ -142,6 +124,7 @@ class KeyBuffer(object):
 			return None
 		assert isinstance(key, int)
 		assert key >= 0
+		self.all_keys.append(key)
 
 		# evaluate quantifiers
 		if self.eval_quantifier and self._do_eval_quantifier(key):
@@ -192,7 +175,11 @@ class KeyBuffer(object):
 					self.failure = True
 					return None
 			else:
-				direction = match.actions['dir'] * self.direction_quant
+				if self.direction_quant is not None:
+					direction = match.actions['dir'] * self.direction_quant
+					direction.has_explicit_direction = True
+				else:
+					direction = match.actions['dir'].copy()
 				self.directions.append(direction)
 				self.direction_quant = None
 				self.eval_command = True