From f66939e58bb54828fe9ef9de919e4f039400472f Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 12 Apr 2010 18:18:49 +0200 Subject: added Direction.select() --- ranger/ext/direction.py | 7 +++++++ 1 file changed, 7 insertions(+) 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] -- cgit 1.4.1-2-gfad0