From f28d418a7e6e22b5f0661e30a8d0fceb22067661 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 21 Apr 2013 21:32:07 +0200 Subject: 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 --- ranger/container/settings.py | 20 ++++++++++++-------- 1 file 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: -- cgit 1.4.1-2-gfad0