summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorThe Flying Rapist <admin@nosuck.org>2015-01-02 05:35:42 +0900
committerThe Flying Rapist <admin@nosuck.org>2015-01-02 05:35:42 +0900
commit30212099f0055f3cb9906457415c34e83ea4fa28 (patch)
tree6f2160dd6cdc7c073f715d5a5d77279618fd04b1 /ranger
parent2ec8ec54cfc968dc03cb0078f24c5a668a0864cd (diff)
downloadranger-30212099f0055f3cb9906457415c34e83ea4fa28.tar.gz
renameConsole -> rename_append; added special cases for hidden files and directories
Diffstat (limited to 'ranger')
-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>