about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-25 07:21:18 +0100
committerhut <hut@lavabit.com>2009-12-25 07:21:18 +0100
commit4781d4246e24105809c26e1b93b772533e1ad61c (patch)
treeec03a231a33fe01e9330b3326e993849983021a9
parent5b4dd42744f16b68e6f6e4736a64326e13e2b260 (diff)
downloadranger-4781d4246e24105809c26e1b93b772533e1ad61c.tar.gz
don't modify directory.__dict__ until last yield of load generator
-rw-r--r--ranger/fsobject/directory.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index 136752f8..9942984a 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -112,9 +112,9 @@ class Directory(FileSystemObject, SettingsAware):
 
 		self.loading = True
 		self.load_if_outdated()
-		yield
 
 		if self.exists and self.runnable:
+			yield
 			filenames = []
 			for fname in listdir(self.path):
 				if not self.settings.show_hidden and fname[0] == '.':
@@ -122,17 +122,13 @@ class Directory(FileSystemObject, SettingsAware):
 				if isinstance(self.filter, str) and self.filter in fname:
 					continue
 				filenames.append(join(self.path, fname))
-			self.scroll_offset = 0
-			self.filenames = filenames
-			self.infostring = ' %d' % len(self.filenames) # update the infostring
 			yield
 
 			marked_paths = set(map( \
 					lambda obj: obj.path, self.marked_items))
-			self._clear_marked_items()
 
 			files = []
-			for name in self.filenames:
+			for name in filenames:
 				if isdir(name):
 					try:
 						item = self.fm.env.get_directory(name)
@@ -144,8 +140,12 @@ class Directory(FileSystemObject, SettingsAware):
 				files.append(item)
 				yield
 
+			self.scroll_offset = 0
+			self.filenames = filenames
+			self.infostring = ' %d' % len(self.filenames) # update the infostring
 			self.files = files
 
+			self._clear_marked_items()
 			for item in self.files:
 				if item.path in marked_paths:
 					self.mark_item(item, True)