about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2022-05-27 14:07:21 +0200
committertoonn <toonn@toonn.io>2022-05-27 14:07:21 +0200
commit6cef19e07fe3dfe905d81fa134dcf5b4089f6780 (patch)
treef544c4fbf494842181bf8ec4b77b768176382f4c
parent72dab6555185ce92e3fb50e7f857f981cc1a7f83 (diff)
downloadranger-6cef19e07fe3dfe905d81fa134dcf5b4089f6780.tar.gz
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.
-rw-r--r--ranger/gui/widgets/browsercolumn.py2
1 files changed, 1 insertions, 1 deletions
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