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:
new html renderings' href='/akkartik/mu/commit/html/exception1.mu.html?h=hlt&id=ac07e589b3e912c704c2011d543f18b16712ff15'>ac07e589 ^
7452d052 ^
































e4ac3c9e ^
7452d052 ^









5fe060d5 ^

7452d052 ^















































5fe060d5 ^
7452d052 ^




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123