summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMark Rogalski <interesting.ones.are.already.taken@gmail.com>2016-05-16 21:32:05 +0200
committerMark Rogalski <interesting.ones.are.already.taken@gmail.com>2016-05-16 21:32:05 +0200
commite815a2fe199745f869e180bf308638df7b7ed67d (patch)
tree859bd3d80b045a1667ca019b28c337db5c65ce04
parent3b8181fa029d282770091a16c784916c9c8548cf (diff)
downloadranger-e815a2fe199745f869e180bf308638df7b7ed67d.tar.gz
Set linum_text_len to digits of visible files
This is changed back from the amount of number of digits in number of
files in directory.  Computing proper relative line numbers requires
recalculation of line numbers for each line (even for cached lines), so
there will be no visible ragged line numbers with this setting.
-rw-r--r--ranger/gui/widgets/browsercolumn.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index 56b5da78..9d14ebc3 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -249,10 +249,8 @@ class BrowserColumn(Pager):
         copied = [f.path for f in self.fm.copy_buffer]
 
         # Set the size of the linum text field to the number of digits in the
-        # number of files in directory.
-        # Setting this to something like the len of (self.scroll_begin +
-        # self.hei) leads to ragged field lengths when digit amounts change.
-        linum_text_len = len(str(len(self.target.files)))
+        # visible files in directory.
+        linum_text_len = len(str(self.scroll_begin + self.hei))
         linum_format = "{0:>" + str(linum_text_len) + "}"
         # add separator between line number and tag
         linum_format += " "