diff options
author | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2018-10-14 19:01:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-14 19:01:21 +0200 |
commit | 16949531f739ccf0cbf8ae543e7282de4291e165 (patch) | |
tree | 9262762dc3d714d8ad8bcc4fc69615ec9fd63e2c | |
parent | 8ae28d7d6a6bb49daaefb5cc19571422c411b3de (diff) | |
parent | 2c4566399e9def85689dbc0e1e49977c0a550345 (diff) | |
download | ranger-16949531f739ccf0cbf8ae543e7282de4291e165.tar.gz |
Merge pull request #1339 from GermainZ/file_preview_scrolling_limits
Do not allow scrolling beyond end of file preview
-rw-r--r-- | ranger/core/actions.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 89c5124b..4e76df65 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -998,12 +998,15 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m def scroll_preview(self, lines, narg=None): """:scroll_preview <lines> -Scroll the file preview by <lines> lines.""" + Scroll the file preview by <lines> lines. + """ preview_column = self.ui.browser.columns[-1] if preview_column.target and preview_column.target.is_file: if narg is not None: lines = narg - preview_column.scrollbit = max(0, preview_column.scrollbit + lines) + target_scroll = preview_column.scrollbit + lines + max_scroll = len(preview_column.lines) - preview_column.hei + preview_column.scrollbit = max(0, min(target_scroll, max_scroll)) preview_column.request_redraw() # -------------------------- |