diff options
author | hut <hut@lavabit.com> | 2011-09-25 01:01:37 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2011-09-25 01:01:37 +0200 |
commit | bbaf1b089b814bde00aa08a76a66629ece92837c (patch) | |
tree | 60b28d47325e0774b06afb670e7bf34e096b3fde | |
parent | 1c6485c6e0eae47be5e0ec19e46fa1a0058fe91e (diff) | |
download | ranger-bbaf1b089b814bde00aa08a76a66629ece92837c.tar.gz |
documented and improved DaPangus' changes
-rw-r--r-- | doc/ranger.1 | 5 | ||||
-rw-r--r-- | doc/ranger.pod | 5 | ||||
-rw-r--r-- | ranger/defaults/commands.py | 3 |
3 files changed, 7 insertions, 6 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1 index 406297bd..6cc2b5e4 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -565,9 +565,8 @@ Quit ranger. The current directory will be bookmarked as ' so you can re-enter it by typing `` or '' the next time you start ranger. .IP "rename \fInewname\fR" 2 .IX Item "rename newname" -Rename the current file. If a file with that name already exists, it will be -overwritten without notice. Also try the key binding A for appending something -to a file name. +Rename the current file. If a file with that name already exists, the renaming +will fail. Also try the key binding A for appending something to a file name. .IP "save_copy_buffer" 2 .IX Item "save_copy_buffer" Save the copy buffer from \fI~/.config/ranger/copy_buffer\fR. This can be used to diff --git a/doc/ranger.pod b/doc/ranger.pod index 8f6cc62a..f6dbdb60 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -592,9 +592,8 @@ it by typing `` or '' the next time you start ranger. =item rename I<newname> -Rename the current file. If a file with that name already exists, it will be -overwritten without notice. Also try the key binding A for appending something -to a file name. +Rename the current file. If a file with that name already exists, the renaming +will fail. Also try the key binding A for appending something to a file name. =item save_copy_buffer diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py index a96c842c..3327c221 100644 --- a/ranger/defaults/commands.py +++ b/ranger/defaults/commands.py @@ -647,6 +647,9 @@ class rename(Command): if not new_name: return self.fm.notify('Syntax: rename <newname>', bad=True) + if new_name == self.fm.env.cf.basename: + return + if access(new_name, os.F_OK): return self.fm.notify("Can't rename: file already exists!", bad=True) |