diff options
author | pavel <pavel989@gmail.com> | 2018-10-07 17:59:33 -0400 |
---|---|---|
committer | pavel <pavel989@gmail.com> | 2018-10-07 17:59:33 -0400 |
commit | 40f13d845bd492003dce09277f006249f6aa628c (patch) | |
tree | 11c019fbe64ae5348d6eae35b9e9f4dd547f136e | |
parent | 41e19fd36aff34f3743d47345c5d83c247964fb3 (diff) | |
download | ranger-40f13d845bd492003dce09277f006249f6aa628c.tar.gz |
limited scrolling to the end of the file
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index d5741d09..c0446995 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -96,11 +96,12 @@ 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: ##scrolling through file preview? - if len(self.lines) > self.hei: ##is it longer than we can show? - if self.scrollbit > -1: ## have we reached the the top? - self.scrollbit += direction # influence the start point - if self.scrollbit < 0: #make sure we dont scroll before the file - self.scrollbit = 0 + if direction > 0 and len(self.lines) > self.hei+self.scrollbit: ##is there more to show? + self.scrollbit += direction # influence the start point + if self.scrollbit < 0: #make sure we dont scroll before or after the file + self.scrollbit = 0 + if direction < 0 and self.scrollbit > 0: ## have we reached the the top + self.scrollbit += direction # influence the start point self.need_redraw = True else: if self.level > 0 and not direction: |