summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-12 18:18:49 +0200
committerhut <hut@lavabit.com>2010-04-12 18:18:49 +0200
commitf66939e58bb54828fe9ef9de919e4f039400472f (patch)
tree8e52712b7453274ee8ebd561b755fbc4b09eb606
parent3cc9e8aa5592d370a0d355584a3716765531a439 (diff)
downloadranger-f66939e58bb54828fe9ef9de919e4f039400472f.tar.gz
added Direction.select()
-rw-r--r--ranger/ext/direction.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py
index 0b3f55f7..f96ee90f 100644
--- a/ranger/ext/direction.py
+++ b/ranger/ext/direction.py
@@ -133,3 +133,10 @@ class Direction(dict):
 		else:
 			pos += current
 		return int(max(min(pos, maximum + offset - 1), minimum))
+
+	def select(self, lst, override, current, pagesize):
+		destination = self.move(direction=self.down(), override=override,
+			current=current, pagesize=pagesize, minimum=0, maximum=len(lst))
+		if destination > current:
+			return destination, lst[current:destination]
+		return destination, lst[destination:current]