summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-04-21 21:32:07 +0200
committerhut <hut@lavabit.com>2013-04-21 21:32:30 +0200
commitf28d418a7e6e22b5f0661e30a8d0fceb22067661 (patch)
treea6e080a7af9dc8f65676f4907645662ac0ad3e0b
parenta22264f1551a308864ad787d508715c30cb30bbe (diff)
downloadranger-f28d418a7e6e22b5f0661e30a8d0fceb22067661.tar.gz
container.settings: fix "setintag" with certain settings
To reproduce the bug:
1. type ":setintag * sort ctime" into the console
2. ensure that the directory ~ is untagged and ~/dl is tagged with "*"
3. change directory to ~/dl/
4. press ^R

The result is that ~ is sorted by ctime even though it shouldn't be.
this is because it uses the settings of fm.thisdir rather than it own
settings.

This commit fixes this bug
-rw-r--r--ranger/container/settings.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 71f3e601..75d74fd6 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -6,7 +6,7 @@ from ranger.ext.signals import SignalDispatcher, Signal
 from ranger.core.shared import FileManagerAware
 from ranger.gui.colorscheme import _colorscheme_name_to_class
 import re
-import os
+import os.path
 
 ALLOWED_SETTINGS = {
     'autosave_bookmarks': bool,
@@ -122,19 +122,23 @@ class Settings(SignalDispatcher, FileManagerAware):
 
     def get(self, name, path=None):
         assert name in ALLOWED_SETTINGS, "No such setting: {0}!".format(name)
-        if not path:
+        if path:
+            localpath = path
+        else:
             try:
-                path = self.fm.thisdir.path
+                localpath = self.fm.thisdir.path
             except:
-                pass
-        if path:
+                localpath = path
+
+        if localpath:
             for pattern, regex in self._localregexes.items():
                 if name in self._localsettings[pattern] and\
-                        regex.search(path):
+                        regex.search(localpath):
                     return self._localsettings[pattern][name]
         if self._tagsettings and path:
-            if self.fm.thisdir.realpath in self.fm.tags:
-                tag = self.fm.tags.marker(self.fm.thisdir.realpath)
+            realpath = os.path.realpath(path)
+            if realpath in self.fm.tags:
+                tag = self.fm.tags.marker(realpath)
                 if tag in self._tagsettings and name in self._tagsettings[tag]:
                     return self._tagsettings[tag][name]
         if name in self._settings:
ary/Implementation/HTWriter.c?id=86b4d41a7463bd35cf662fc748aa338caef609c9'>86b4d41a ^
e087f6d4

9c63ba04 ^
e087f6d4
86b4d41a ^
e087f6d4




86b4d41a ^

e087f6d4

d3f9d547 ^
e087f6d4









86b4d41a ^
e087f6d4
































86b4d41a ^

e087f6d4




86b4d41a ^
e087f6d4

d3f9d547 ^
e087f6d4





















86b4d41a ^
e087f6d4








86b4d41a ^
e087f6d4




86b4d41a ^
e087f6d4









86b4d41a ^

e087f6d4

86b4d41a ^
e087f6d4












86b4d41a ^
e087f6d4


86b4d41a ^
e087f6d4




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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183