diff options
author | hut <hut@lepus.uberspace.de> | 2016-01-04 20:49:33 +0100 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2016-01-04 20:49:33 +0100 |
commit | 0614b5e4aea03db92a6434098ed6666d02d5c166 (patch) | |
tree | f1fd71725f87690e5be214da1fcb3acda98bc32f /ranger | |
parent | 91a552f35bb0484b7d9c4f1a423b4cea446bb742 (diff) | |
download | ranger-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.py | 17 |
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') |