aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2022-05-26 20:11:46 +0200
committertoonn <toonn@toonn.io>2022-05-26 23:42:14 +0200
commit9b47c41a3717ebcb7deeccd0ba947eb50069634e (patch)
treece2158009098d7f0835b5a9660b8c4e9b6a198d3
parentc9cb40d86bcfb7cff6453d99ba0ed70356203b5c (diff)
downloadranger-9b47c41a3717ebcb7deeccd0ba947eb50069634e.tar.gz
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 <mail.markus.bauer@gmail.com>
-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 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: