summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBaranovskiy Konstantin <baranovskiykonstantin@gmail.com>2018-10-25 16:07:04 +0300
committerBaranovskiy Konstantin <baranovskiykonstantin@gmail.com>2018-10-26 14:28:53 +0300
commitd6ac6d04ee61dffae0df811d9f424508b87580ab (patch)
tree88a18e372965b5dcf3321a8fbedb68d860806544
parentffee23a4d92a6f71cd62a6c763b13163e1bfae4a (diff)
downloadranger-d6ac6d04ee61dffae0df811d9f424508b87580ab.tar.gz
Restoration of scrolling in pager.
Fixes #1347
-rw-r--r--ranger/core/actions.py5
-rw-r--r--ranger/gui/widgets/browsercolumn.py5
-rw-r--r--ranger/gui/widgets/pager.py6
3 files changed, 8 insertions, 8 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 1b5d0028..20a180e9 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -1004,10 +1004,7 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
         if preview_column.target and preview_column.target.is_file:
             if narg is not None:
                 lines = narg
-            target_scroll = preview_column.scroll_extra + lines
-            max_scroll = len(preview_column.lines) - preview_column.hei
-            preview_column.scroll_extra = max(0, min(target_scroll, max_scroll))
-            preview_column.request_redraw()
+            preview_column.scrollbit(lines)
 
     # --------------------------
     # -- Previews
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index 8d2e63eb..ecc66f44 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -96,10 +96,7 @@ class BrowserColumn(Pager):  # pylint: disable=too-many-instance-attributes
                             self.fm.thisdir.move_to_obj(clicked_file)
                             self.fm.execute_file(clicked_file)
         elif self.target.is_file:
-            target_scroll = self.scroll_extra + direction
-            max_scroll = len(self.lines) - self.hei
-            self.scroll_extra = max(0, min(target_scroll, max_scroll))
-            self.need_redraw = True
+            self.scrollbit(direction)
         else:
             if self.level > 0 and not direction:
                 self.fm.move(right=0)
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index 3bb52e3f..c1aa2765 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -75,6 +75,12 @@ class Pager(Widget):  # pylint: disable=too-many-instance-attributes
     def finalize(self):
         self.fm.ui.win.move(self.y, self.x)
 
+    def scrollbit(self, lines):
+        target_scroll = self.scroll_extra + lines
+        max_scroll = len(self.lines) - self.hei
+        self.scroll_extra = max(0, min(target_scroll, max_scroll))
+        self.need_redraw = True
+
     def draw(self):
         if self.need_clear_image:
             self.need_redraw = True