From fa4c3bbd9e33fde2727c5056c5f9d866a6227fe8 Mon Sep 17 00:00:00 2001 From: Laurent Charignon Date: Sat, 30 Jan 2016 18:43:59 -0800 Subject: bookmarks: fix issue #447 Bookmarks aren't updated on renaming --- ranger/config/commands.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ranger') diff --git a/ranger/config/commands.py b/ranger/config/commands.py index eb4ee4c3..9aee9f29 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -771,6 +771,14 @@ class rename(Command): if self.fm.rename(self.fm.thisfile, new_name): f = File(new_name) + # Update bookmarks that were pointing on the previous name + obsoletebookmarks = [b for b in self.fm.bookmarks + if b[1].path == self.fm.thisfile] + if obsoletebookmarks: + for key, _ in obsoletebookmarks: + self.fm.bookmarks[key] = f + self.fm.bookmarks.update_if_outdated() + self.fm.thisdir.pointed_obj = f self.fm.thisfile = f for t in tagged: -- cgit 1.4.1-2-gfad0