summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-30 02:16:24 +0100
committerhut <hut@lavabit.com>2010-01-30 02:16:24 +0100
commit3300c3e213fbf34a6bd47862fae60a2e33ca1529 (patch)
tree534a6d68300b558ad78893be675cc8248e2f91ef /ranger
parent2d0c856b3543d80bb043ddd7d597ed4dc0a2e42c (diff)
downloadranger-3300c3e213fbf34a6bd47862fae60a2e33ca1529.tar.gz
actions: implemented numerical argument for mark()
Diffstat (limited to 'ranger')
-rw-r--r--ranger/actions.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/ranger/actions.py b/ranger/actions.py
index d00997c8..095dc24b 100644
--- a/ranger/actions.py
+++ b/ranger/actions.py
@@ -349,7 +349,7 @@ class Actions(EnvironmentAware, SettingsAware):
 		if hasattr(self.ui, 'notify'):
 			self.ui.notify(text, duration=duration, bad=bad)
 
-	def mark(self, all=False, toggle=False, val=None, movedown=None):
+	def mark(self, all=False, toggle=False, val=None, movedown=None, narg=1):
 		"""
 		A wrapper for the directory.mark_xyz functions.
 
@@ -376,15 +376,16 @@ class Actions(EnvironmentAware, SettingsAware):
 			else:
 				pwd.mark_all(val)
 		else:
-			item = self.env.cf
-			if item is not None:
-				if toggle:
-					pwd.toggle_mark(item)
-				else:
-					pwd.mark_item(item, val)
+			for i in range(pwd.pointer, min(pwd.pointer + narg, len(pwd))):
+				item = pwd.files[i]
+				if item is not None:
+					if toggle:
+						pwd.toggle_mark(item)
+					else:
+						pwd.mark_item(item, val)
 
 		if movedown:
-			self.move_pointer(relative=1)
+			self.move_pointer(relative=narg)
 
 		if hasattr(self.ui, 'redraw_main_column'):
 			self.ui.redraw_main_column()