From 30212099f0055f3cb9906457415c34e83ea4fa28 Mon Sep 17 00:00:00 2001 From: The Flying Rapist Date: Fri, 2 Jan 2015 05:35:42 +0900 Subject: renameConsole -> rename_append; added special cases for hidden files and directories --- ranger/config/commands.py | 12 ++++++------ 1 file 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 -- cgit 1.4.1-2-gfad0 a class='active' href='/akkartik/mu/blame/test_all_layers?h=main&id=f68236426287232d009e99e7515da06b94f85c8b'>blame commit diff stats
blob: bb06360640bb998c43e20c32d77e66e86749dddf (plain) (tree)
1
2
3
4
5
6
7
8
9