From 72dab6555185ce92e3fb50e7f857f981cc1a7f83 Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 27 May 2022 13:57:58 +0200 Subject: browsercolumn: Take into account one_indexed setting Line number width calculation was ignoring the one_indexed setting. This meant recalculating the width one line too late. --- ranger/gui/widgets/browsercolumn.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 4867d184..305b8284 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -283,14 +283,17 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes scroll_end = self.scroll_begin + self.hei - 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 if self.settings.line_numbers.lower() == "relative": linum_text_len = nr_of_digits(max(distance_to_top, distance_to_bottom)) if not self.settings.relative_current_zero: - linum_text_len = max(nr_of_digits(selected_i), linum_text_len) + linum_text_len = max(nr_of_digits(selected_i + + one_indexed_offset), + linum_text_len) else: - linum_text_len = nr_of_digits(scroll_end) + linum_text_len = nr_of_digits(scroll_end + one_indexed_offset) linum_format = "{0:>" + str(linum_text_len) + "}" for line in range(self.hei): -- cgit 1.4.1-2-gfad0