summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-05 05:55:53 +0100
committerhut <hut@lavabit.com>2013-02-05 05:55:53 +0100
commit151ff73951af08a7d5611c22ce25f095feda3c6b (patch)
treef618761a5681f0cd36a3c7c73f4c8793279099c5 /ranger
parent6483b2f2c6d10c15cd6f1eab5fa4dc6b08e305d4 (diff)
downloadranger-151ff73951af08a7d5611c22ce25f095feda3c6b.tar.gz
core.tab: Fix files being treated as dirs after rename
When you deleted a directory and created a file with the same name, it
was treated like a directory, with ranger trying to preview it and
throwing lots of errors.  This was because it tried to look for the path
of the currently selected file in fm.directories - a directory cache -
and if a file with the same name existed as a directory once, it would
have found it there.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/tab.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/ranger/core/tab.py b/ranger/core/tab.py
index 8ae74141..443b2037 100644
--- a/ranger/core/tab.py
+++ b/ranger/core/tab.py
@@ -61,20 +61,15 @@ class Tab(FileManagerAware, SettingsAware):
 			except IndexError:
 				return None
 		else:
-			directory = self.thisfile
-			for i in range(level - 1):
+			directory = self.thisdir
+			for i in range(level):
 				if directory is None:
 					return None
 				if directory.is_directory:
 					directory = directory.pointed_obj
 				else:
 					return None
-			try:
-				return self.fm.directories[directory.path]
-			except AttributeError:
-				return None
-			except KeyError:
-				return directory
+			return directory
 
 	def get_selection(self):
 		if self.thisdir:
f='#n176'>176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260