From b0016cb93da5b65277403dd99c06d7f0a09dfbcc Mon Sep 17 00:00:00 2001 From: GermainZ Date: Sun, 14 Oct 2018 17:23:11 +0200 Subject: Do not allow scrolling beyond end of file preview --- ranger/core/actions.py | 7 +++++-- 1 file 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 -Scroll the file preview by lines.""" + Scroll the file preview by 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() # -------------------------- -- cgit 1.4.1-2-gfad0 t/tc_keyapi.py?h=v1.9.3'>log tree commit diff stats
blob: d6c32271108b817de9759fbddc6ba0e1a7566555 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25