From 03b4aefab11192a20d541963d12b61c09738d6d2 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 5 Feb 2010 05:56:42 +0100 Subject: commands: keep pointer on the file when renaming --- ranger/commands.py | 4 ++++ ranger/fsobject/fsobject.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) 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() -- cgit 1.4.1-2-gfad0