about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-01 19:25:07 +0100
committerhut <hut@lavabit.com>2010-01-01 19:25:07 +0100
commitd955e3f04a2b0509e8053a15a1f916bfb5677af2 (patch)
treed7a78eb532e71ec69055cd6738b34ea094506e1c /ranger
parent7d6389d61aa56db355033166b415dd0b83dabff9 (diff)
downloadranger-d955e3f04a2b0509e8053a15a1f916bfb5677af2.tar.gz
bookmarks: fixed disappearing bookmarks
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/bookmarks.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py
index 854758bd..738efe46 100644
--- a/ranger/container/bookmarks.py
+++ b/ranger/container/bookmarks.py
@@ -35,7 +35,7 @@ class Bookmarks(object):
 		except OSError:
 			return
 
-		self._set_dict(new_dict)
+		self._set_dict(new_dict, original=new_dict)
 
 	def delete(self, key):
 		"""Delete the bookmark with the given key"""
@@ -93,6 +93,7 @@ class Bookmarks(object):
 		
 		try:
 			real_dict = self._load_dict()
+			real_dict_copy = real_dict.copy()
 		except OSError:
 			return
 
@@ -120,7 +121,7 @@ class Bookmarks(object):
 			else:
 				real_dict[key] = current
 
-		self._set_dict(real_dict)
+		self._set_dict(real_dict, original=real_dict_copy)
 
 	def save(self):
 		"""Save the bookmarks to the bookmarkfile.
@@ -156,10 +157,13 @@ class Bookmarks(object):
 		else:
 			raise OSError('Cannot read the given path')
 	
-	def _set_dict(self, dct):
+	def _set_dict(self, dct, original):
+		if original is None:
+			original = {}
+
 		self.dct.clear()
 		self.dct.update(dct)
-		self.original_dict = self.dct.copy()
+		self.original_dict = original
 		self._update_mtime()
 
 	def _get_mtime(self):