From 9b47c41a3717ebcb7deeccd0ba947eb50069634e Mon Sep 17 00:00:00 2001 From: toonn Date: Thu, 26 May 2022 20:11:46 +0200 Subject: browsercolumn: Include linum_text_len in key The width of an item needs to be recalculated if the width of the line numbers changes. This happens every time we get to another order of magnitude (an additional digit). This is based on [review comments](https://github.com/ranger/ranger/pull/2346#issuecomment-1062257526) from markus-bauer. The solution opted for here is basically their second bullet point. I tried the third bullet point first, replacing `line_numbers` by `linum_text_len` in the key but this requires recalculating `linum_text_len` to be zero when line numbers are disabled, which feels like a somewhat clunky overloading while we have a perfectly usable boolean flag available. Closes #2346 Co-authored-by: markus-bauer --- 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 28e91922..59f2622d 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -307,7 +307,7 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes drawn.path in copied, tagged_marker, drawn.infostring, drawn.vcsstatus, drawn.vcsremotestatus, self.target.has_vcschild, self.fm.do_cut, current_linemode.name, metakey, active_pane, - self.settings.line_numbers) + self.settings.line_numbers, linum_text_len) # Check if current line has not already computed and cached if key in drawn.display_data: -- cgit 1.4.1-2-gfad0