summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorLaurent Charignon <l.charignon@gmail.com>2016-01-30 18:43:59 -0800
committerLaurent Charignon <l.charignon@gmail.com>2016-01-30 18:49:24 -0800
commitfa4c3bbd9e33fde2727c5056c5f9d866a6227fe8 (patch)
tree527d7544f8dc1ea9752316cfd543002ce644fa5d /ranger
parent34e28e6159dece029770a0c172e25021beea9edf (diff)
downloadranger-fa4c3bbd9e33fde2727c5056c5f9d866a6227fe8.tar.gz
bookmarks: fix issue #447 Bookmarks aren't updated on renaming
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/config/commands.py8
1 files changed, 8 insertions, 0 deletions
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: