summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2016-05-06 23:21:05 +0200
committerhut <hut@lepus.uberspace.de>2016-05-06 23:34:27 +0200
commit523689c114f0688e8efb3831e13e5214a2a858f3 (patch)
tree37f423fe38e5952419f4f1513021a64c8e4f02f4
parent4b1207d7a91ba55c8bbd7ab29bc881daeccc3eb7 (diff)
downloadranger-523689c114f0688e8efb3831e13e5214a2a858f3.tar.gz
core.actions: fix calculation of program indices
The solutoin of @NoSuck used to break when you used "number 9999" in a
declaration of some program.
-rw-r--r--ranger/core/actions.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 71cb5929..0224db6d 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -824,10 +824,11 @@ class Actions(FileManagerAware, SettingsAware):
             return
         programs = [program for program in self.rifle.list_commands([target.path],
                 None)]
-        num_digits = len(str(len(programs)))
-        program_info = ['%s | %s' % (str(program[0]).rjust(num_digits),
-                program[1]) for program in programs]
-        self.ui.browser.draw_info = program_info
+        if programs:
+            num_digits = max((len(str(program[0])) for program in programs))
+            program_info = ['%s | %s' % (str(program[0]).rjust(num_digits),
+                    program[1]) for program in programs]
+            self.ui.browser.draw_info = program_info
 
     def hide_console_info(self):
         self.ui.browser.draw_info = False