From 6cef19e07fe3dfe905d81fa134dcf5b4089f6780 Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 27 May 2022 14:07:21 +0200 Subject: browsercolumn: Use number of items for width The width of the widest line number, which is often the last one visible in the list is not always the same thing as the width of the item that would be at the very bottom of the screen. When a directory contains fewer items than lines are available for display, the former can have fewer digits. --- ranger/gui/widgets/browsercolumn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 305b8284..0a3dc928 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -280,7 +280,7 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes def nr_of_digits(number): return len(str(number)) - scroll_end = self.scroll_begin + self.hei - 1 + scroll_end = self.scroll_begin + min(self.hei, len(self.target)) - 1 distance_to_top = selected_i - self.scroll_begin distance_to_bottom = scroll_end - selected_i one_indexed_offset = 1 if self.settings.one_indexed else 0 -- cgit 1.4.1-2-gfad0