diff options
author | Mark Rogalski <interesting.ones.are.already.taken@gmail.com> | 2016-05-16 21:21:54 +0200 |
---|---|---|
committer | Mark Rogalski <interesting.ones.are.already.taken@gmail.com> | 2016-05-16 21:21:54 +0200 |
commit | 3b8181fa029d282770091a16c784916c9c8548cf (patch) | |
tree | 35b54945c32201f92885eb77240d7900bf92f3d9 | |
parent | 56134db6dc6b07711f0d892c15b0bd98567619ad (diff) | |
download | ranger-3b8181fa029d282770091a16c784916c9c8548cf.tar.gz |
Add comment with line num implementation rationale
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 1dd4aef8..56b5da78 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -290,7 +290,17 @@ class BrowserColumn(Pager): self.fm.do_cut, current_linemode.name, metakey, active_pane, self.settings.line_numbers) + # Check if current line has not already computed and cached if key in drawn.display_data: + # This conditional is necessary for two things: + # 1) computing relative line numbers, + # 2) switching between relative line numbers and normal. + # + # (1) is necessary because drawn.display_data cache cannot be + # trusted when it comes to line numbers. + # For (2) we could add self.settings.relative_line_numbers to + # key, but we still require a conditional check here for (1), + # and it solves both problems at the same time. if self.main_column and self.settings.line_numbers: line_number_text = self._format_line_number(linum_format, i, |