summary refs log tree commit diff stats
path: root/ranger/gui/widgets/browsercolumn.py
diff options
context:
space:
mode:
Diffstat (limited to 'ranger/gui/widgets/browsercolumn.py')
-rw-r--r--ranger/gui/widgets/browsercolumn.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index 3845dc41..8d2e63eb 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -96,7 +96,9 @@ 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:
-            self.scrollbit = max(0, self.scrollbit + direction)
+            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
         else:
             if self.level > 0 and not direction:
@@ -157,7 +159,7 @@ class BrowserColumn(Pager):  # pylint: disable=too-many-instance-attributes
         if target != self.old_dir:
             self.need_redraw = True
             self.old_dir = target
-            self.scrollbit = 0  # reset scroll start
+            self.scroll_extra = 0  # reset scroll start
 
         if target:
             target.use()