summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-02-05 05:56:42 +0100
committerhut <hut@lavabit.com>2010-02-05 06:06:47 +0100
commit03b4aefab11192a20d541963d12b61c09738d6d2 (patch)
tree951f7de9b144c54bdaea6481e8f525c69248aa7d
parent66c5bb9320b908f32fd83493a7a283c62bde959c (diff)
downloadranger-03b4aefab11192a20d541963d12b61c09738d6d2.tar.gz
commands: keep pointer on the file when renaming
-rw-r--r--ranger/commands.py4
-rw-r--r--ranger/fsobject/fsobject.py3
2 files changed, 6 insertions, 1 deletions
diff --git a/ranger/commands.py b/ranger/commands.py
index c552053f..0903e00a 100644
--- a/ranger/commands.py
+++ b/ranger/commands.py
@@ -324,8 +324,12 @@ class rename(Command):
 	"""
 
 	def execute(self):
+		from ranger.fsobject.file import File
 		line = parse(self.line)
 		self.fm.rename(self.fm.env.cf, line.rest(1))
+		f = File(line.rest(1))
+		self.fm.env.pwd.pointed_obj = f
+		self.fm.env.cf = f
 
 	def tab(self):
 		return self._tab_directory_content()
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index 5ede5927..df7a989f 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -57,8 +57,9 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 		if type(self) == FileSystemObject:
 			raise TypeError("Cannot initialize abstract class FileSystemObject")
 
-		from os.path import basename, dirname, realpath
+		from os.path import abspath, basename, dirname, realpath
 
+		path = abspath(path)
 		self.path = path
 		self.basename = basename(path)
 		self.basename_lower = self.basename.lower()