diff options
-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: |