summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/config/commands.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index c496f71e..a8813de2 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -722,18 +722,18 @@ class rename(Command):
     def tab(self):
         return self._tab_directory_content()
 
-class renameConsole(Command):
-    """:renameConsole
+class rename_append(Command):
+    """:rename_append
 
     Creates an open_console for the rename command, automatically placing the cursor before the file extension.
     """
 
     def execute(self):
-        if "." in self.fm.thisfile.basename:
-            offset = 6 + len(self.fm.thisfile.basename) - self.fm.thisfile.basename[::-1].index('.')
-            self.fm.open_console('rename ' + self.fm.thisfile.basename, position=offset)
+        cf = self.fm.thisfile
+        if cf.basename.find('.') != 0 and cf.basename.rfind('.') != -1 and not cf.is_directory:
+            self.fm.open_console('rename ' + cf.basename, position=(7 + cf.basename.rfind('.')))
         else:
-            self.fm.open_console('rename ' + self.fm.thisfile.basename)
+            self.fm.open_console('rename ' + cf.basename)
 
 class chmod(Command):
     """:chmod <octal number>
href='#n113'>113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174