about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2016-01-04 20:49:33 +0100
committerhut <hut@lepus.uberspace.de>2016-01-04 20:49:33 +0100
commit0614b5e4aea03db92a6434098ed6666d02d5c166 (patch)
treef1fd71725f87690e5be214da1fcb3acda98bc32f /ranger
parent91a552f35bb0484b7d9c4f1a423b4cea446bb742 (diff)
downloadranger-0614b5e4aea03db92a6434098ed6666d02d5c166.tar.gz
widgets.pager: fix 'G' key in streams, fixes #74
Thanks to genkimarhsall for helping me in
https://github.com/hut/ranger/issues/74
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/widgets/pager.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index ca4e2970..ce3cc1bf 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -124,15 +124,24 @@ class Pager(Widget):
                     pagesize=self.wid,
                     offset=-self.wid + 1)
         if direction.vertical():
-            if self.source_is_stream:
-                self._get_line(self.scroll_begin + self.hei * 2)
-            self.scroll_begin = direction.move(
+            movement = dict(
                     direction=direction.down(),
                     override=narg,
-                    maximum=len(self.lines),
                     current=self.scroll_begin,
                     pagesize=self.hei,
                     offset=-self.hei + 1)
+            if self.source_is_stream:
+                # For streams, we first pretend that the content ends much later,
+                # in case there are still unread lines.
+                desired_position = direction.move(
+                        maximum=len(self.lines) + 9999,
+                        **movement)
+                # Then, read the new lines as needed to produce a more accurate
+                # maximum for the movement:
+                self._get_line(desired_position + self.hei)
+            self.scroll_begin = direction.move(
+                    maximum=len(self.lines),
+                    **movement)
 
     def press(self, key):
         self.fm.ui.keymaps.use_keymap('pager')