summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMark Rogalski <interesting.ones.are.already.taken@gmail.com>2016-05-16 19:33:06 +0200
committerMark Rogalski <interesting.ones.are.already.taken@gmail.com>2016-05-16 19:33:06 +0200
commit902fdb7a2396c34b7e9ff3e02a86c23fde55f569 (patch)
tree0672480e381ade996a97a1bdd4ce3586c2d1c38f
parent1bc67ebef2f1515b008b3464eade6745093fc6a5 (diff)
downloadranger-902fdb7a2396c34b7e9ff3e02a86c23fde55f569.tar.gz
Fix ragged line number fields
This changes the number field size to the amount of digits in the number
of files in the directory.
-rw-r--r--ranger/gui/widgets/browsercolumn.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index eff7fda6..9ab668e1 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -241,7 +241,11 @@ class BrowserColumn(Pager):
 
         linum_mode_is_set = True
 
-        linum_text_len = len(str(self.scroll_begin + self.hei))
+        # 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)))
 
         selected_i = self._get_index_of_selected_file()
         for line in range(self.hei):