diff options
author | hut <hut@lavabit.com> | 2010-04-12 18:18:49 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-12 18:18:49 +0200 |
commit | f66939e58bb54828fe9ef9de919e4f039400472f (patch) | |
tree | 8e52712b7453274ee8ebd561b755fbc4b09eb606 /ranger | |
parent | 3cc9e8aa5592d370a0d355584a3716765531a439 (diff) | |
download | ranger-f66939e58bb54828fe9ef9de919e4f039400472f.tar.gz |
added Direction.select()
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/ext/direction.py | 7 |
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] |