diff options
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 12 | ||||
-rw-r--r-- | ranger/gui/widgets/pager.py | 2 |
2 files changed, 4 insertions, 10 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 6f08f329..3845dc41 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -60,7 +60,7 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes def request_redraw(self): self.need_redraw = True - def click(self, event): + def click(self, event): # pylint: disable=too-many-branches """Handle a MouseEvent""" direction = event.mouse_wheel_direction() if not (event.pressed(1) or event.pressed(3) or direction): @@ -95,14 +95,8 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes elif self.level == 0: self.fm.thisdir.move_to_obj(clicked_file) self.fm.execute_file(clicked_file) - elif self.target.is_file: # scrolling through file preview? - # Is there more to show? - if direction > 0 and len(self.lines) > self.hei + self.scrollbit: - 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 + elif self.target.is_file: + self.scrollbit = max(0, self.scrollbit + direction) self.need_redraw = True else: if self.level > 0 and not direction: diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index f4555cf9..c88f5ff0 100644 --- a/ranger/gui/widgets/pager.py +++ b/ranger/gui/widgets/pager.py @@ -97,7 +97,7 @@ class Pager(Widget): # pylint: disable=too-many-instance-attributes if not self.image: line_gen = self._generate_lines( - starty=self.scrollbit, startx=self.startx) #updated for new scroll var + starty=self.scrollbit, startx=self.startx) for line, i in zip(line_gen, range(self.hei)): self._draw_line(i, line) |