summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-11-17 00:21:19 +0100
committerhut <hut@lepus.uberspace.de>2015-11-17 00:21:19 +0100
commit979242171a07033ee306253c29cff9e84fb83a26 (patch)
treeecc270bb435b925123748015b7671627bd7b48d0 /ranger
parent47f34c1bd5d14a28ffd128b4f22689e626e24c1e (diff)
downloadranger-979242171a07033ee306253c29cff9e84fb83a26.tar.gz
config/commands.py: fixed off-by-one in :rename_append
cursor used to be misplaced when a filename contained % signs
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/commands.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index a834278d..b281a683 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -777,10 +777,11 @@ class rename_append(Command):
 
     def execute(self):
         cf = self.fm.thisfile
-        if cf.relative_path.find('.') != 0 and cf.relative_path.rfind('.') != -1 and not cf.is_directory:
-            self.fm.open_console('rename ' + cf.relative_path.replace("%", "%%"), position=(7 + cf.relative_path.rfind('.')))
+        path = cf.relative_path.replace("%", "%%")
+        if path.find('.') != 0 and path.rfind('.') != -1 and not cf.is_directory:
+            self.fm.open_console('rename ' + path, position=(7 + path.rfind('.')))
         else:
-            self.fm.open_console('rename ' + cf.relative_path.replace("%", "%%"))
+            self.fm.open_console('rename ' + path)
 
 class chmod(Command):
     """:chmod <octal number>