From 979242171a07033ee306253c29cff9e84fb83a26 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 17 Nov 2015 00:21:19 +0100 Subject: config/commands.py: fixed off-by-one in :rename_append cursor used to be misplaced when a filename contained % signs --- ranger/config/commands.py | 7 ++++--- 1 file 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 -- cgit 1.4.1-2-gfad0