summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMark Rogalski <interesting.ones.are.already.taken@gmail.com>2016-05-16 20:37:48 +0200
committerMark Rogalski <interesting.ones.are.already.taken@gmail.com>2016-05-16 20:37:48 +0200
commitbb5846a689c956a24c44798d32c0c33ad1d97724 (patch)
tree459f79a26297fda6631fa4552e6fea986631491a
parentf9f2a9551f9c83b9924e998704d3cced80c6e80e (diff)
downloadranger-bb5846a689c956a24c44798d32c0c33ad1d97724.tar.gz
Create the linum_format just once
-rw-r--r--ranger/gui/widgets/browsercolumn.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index cbd2f0ab..89e29a00 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -244,6 +244,9 @@ class BrowserColumn(Pager):
         # 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)))
+        linum_format = "{0:>" + str(linum_text_len) + "}"
+        # add separator between line number and tag
+        linum_format += " "
 
         selected_i = self._get_index_of_selected_file()
         for line in range(self.hei):
@@ -300,9 +303,6 @@ class BrowserColumn(Pager):
             # line number field
             if self.settings.line_numbers:
                 if self.main_column and space - linum_text_len > 2:
-                    linum_format = "{0:>" + str(linum_text_len) + "}"
-                    # add separator between line number and tag
-                    linum_format += " "
                     line_number_text = linum_format.format(i)
 
                     predisplay_left.append([line_number_text, ["directory"]])