summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-01-01 22:26:49 +0100
committerhut <hut@lepus.uberspace.de>2015-01-01 22:26:49 +0100
commit7248023cbe8e0778468b0713ca188657bdf492ff (patch)
tree6f2160dd6cdc7c073f715d5a5d77279618fd04b1
parent2ec8ec54cfc968dc03cb0078f24c5a668a0864cd (diff)
parent30212099f0055f3cb9906457415c34e83ea4fa28 (diff)
downloadranger-7248023cbe8e0778468b0713ca188657bdf492ff.tar.gz
Merge branch 'rename_append' of https://github.com/NoSuck/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>
pan> ^
531f14c9 ^
ff8ec9bc ^
71e4f381 ^
ff8ec9bc ^
71e4f381 ^


ff8ec9bc ^
71e4f381 ^
ff8ec9bc ^
71e4f381 ^
ff8ec9bc ^

71e4f381 ^
ff8ec9bc ^
71e4f381 ^
f7746778 ^
7205c246 ^
f7746778 ^
71e4f381 ^
9516dfa0 ^
71e4f381 ^
da438fa9 ^
71e4f381 ^

7205c246 ^

56c92481 ^
c26aef11 ^
7205c246 ^



56c92481 ^
c26aef11 ^
56c92481 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60