summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-01-04 07:22:07 +0100
committerhut <hut@lepus.uberspace.de>2015-01-04 07:22:07 +0100
commit564ff12c4344f4f88c3ee466b1d5b1f15c071ff5 (patch)
tree2396abf49cd222fff3b67beeb9974a585ba3bc70
parent27a24a098f912e960c8ea2043ac34bfd58b618bf (diff)
parent2e8a1516f3c9295cafe50f748078ace5685d8342 (diff)
downloadranger-564ff12c4344f4f88c3ee466b1d5b1f15c071ff5.tar.gz
Merge branch 'move-cycle' of https://github.com/PotatoesMaster/ranger
-rw-r--r--ranger/ext/direction.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py
index 4b20ea0d..bd00fa6b 100644
--- a/ranger/ext/direction.py
+++ b/ranger/ext/direction.py
@@ -81,6 +81,9 @@ class Direction(dict):
     def percentage(self):
         return 'percentage' in self and self['percentage']
 
+    def cycle(self):
+        return self.get('cycle')
+
     def multiply(self, n):
         for key in ('up', 'right', 'down', 'left'):
             try:
@@ -126,6 +129,8 @@ class Direction(dict):
                 pos += maximum
         else:
             pos += current
+        if self.cycle():
+            return minimum + pos % (maximum + offset - minimum)
         return int(max(min(pos, maximum + offset - 1), minimum))
 
     def select(self, lst, current, pagesize, override=None, offset=1):