about summary refs log tree commit diff stats
diff options
context:
space:
mode:
author0xjmz <0xjmz@users.noreply.github.com>2017-07-31 16:12:03 +0200
committerGitHub <noreply@github.com>2017-07-31 16:12:03 +0200
commit0ed04f4559e8f68ee7c74a3ff79cc47b52260764 (patch)
tree2dd781f083d9ea7dcd9996c04d7eed8777345b3b
parenta9309d678fca664df67d8aa9a307669d7f275179 (diff)
parent35f47f53a32b29f746c5ddcd4fb367bf2ad7e640 (diff)
downloadranger-0ed04f4559e8f68ee7c74a3ff79cc47b52260764.tar.gz
Merge branch 'master' into fix-faster-loading
-rwxr-xr-xdoc/tools/convert_papermode_to_metadata.py2
-rwxr-xr-xdoc/tools/performance_test.py5
-rw-r--r--ranger/ext/direction.py14
3 files changed, 16 insertions, 5 deletions
diff --git a/doc/tools/convert_papermode_to_metadata.py b/doc/tools/convert_papermode_to_metadata.py
index e4010a73..57459097 100755
--- a/doc/tools/convert_papermode_to_metadata.py
+++ b/doc/tools/convert_papermode_to_metadata.py
@@ -1,4 +1,4 @@
-#!/bin/python
+#!/usr/bin/env python
 """
 usage: ./convert_papermode_to_metadata.py
 
diff --git a/doc/tools/performance_test.py b/doc/tools/performance_test.py
index f9562f0c..3b9099d5 100755
--- a/doc/tools/performance_test.py
+++ b/doc/tools/performance_test.py
@@ -1,6 +1,7 @@
-#!/usr/bin/python
-# pylint: disable=wrong-import-position
+#!/usr/bin/env python
+
 from __future__ import (absolute_import, division, print_function)
+
 import sys
 import time
 
diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py
index bbb69c9b..e337c26e 100644
--- a/ranger/ext/direction.py
+++ b/ranger/ext/direction.py
@@ -20,6 +20,8 @@ False
 
 from __future__ import (absolute_import, division, print_function)
 
+import math
+
 
 class Direction(dict):
 
@@ -142,8 +144,16 @@ class Direction(dict):
         if self.cycle():
             cycles, pos = divmod(pos, (maximum + offset - minimum))
             self['_move_cycles'] = int(cycles)
-            return int(minimum + pos)
-        return int(max(min(pos, maximum + offset - 1), minimum))
+            ret = minimum + pos
+        else:
+            ret = max(min(pos, maximum + offset - 1), minimum)
+        # Round towards the direction we're moving from.
+        # From the UI point of view, round down. See: #912.
+        if direction < 0:
+            ret = int(math.ceil(ret))
+        else:
+            ret = int(ret)
+        return ret
 
     def move_cycles(self):
         return self.get('_move_cycles', 0)