diff options
author | hut <hut@lavabit.com> | 2013-04-21 21:32:07 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2013-04-21 21:32:30 +0200 |
commit | f28d418a7e6e22b5f0661e30a8d0fceb22067661 (patch) | |
tree | a6e080a7af9dc8f65676f4907645662ac0ad3e0b /ranger | |
parent | a22264f1551a308864ad787d508715c30cb30bbe (diff) | |
download | ranger-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
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/container/settings.py | 20 |
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: |