From 362db3d9869d470c5beabaea098e894a0df4cafe Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Tue, 5 Jan 2016 22:45:52 +0100 Subject: [PATCH] fix remarks --- qutebrowser/browser/hints.py | 13 ++++++------- qutebrowser/config/configtypes.py | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index faa645a71..8039174aa 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -683,7 +683,7 @@ class HintManager(QObject): keyparsers = objreg.get('keyparsers', scope='window', window=self._win_id) keyparser = keyparsers[usertypes.KeyMode.hint] - keyparser.update_bindings(strings) + keyparser.update_bindings(hints) def follow_prevnext(self, frame, baseurl, prev=False, tab=False, background=False, window=False): @@ -981,14 +981,11 @@ class WordHinter: """Generator for word hints. - Class attributes: - Attributes: - + words: A set of words to be used when no "smart hint" can be + derived from the hinted element. """ - FIRST_ALPHABETIC = re.compile('[A-Za-z]{3,}') - def __init__(self): # will be initialized on first use. self.words = set() @@ -1007,8 +1004,10 @@ class WordHinter: # contains none-alphabetic chars continue if len(word) > 4: + # we don't need words longer than 4 continue for i in range(len(word)): + # remove all prefixes of this word hints.discard(word[:i + 1]) hints.add(word) self.words.update(hints) @@ -1044,7 +1043,7 @@ class WordHinter: for candidate in words: if not candidate: continue - match = self.FIRST_ALPHABETIC.search(candidate) + match = re.search('[A-Za-z]{3,}', candidate) if not match: continue if match.end() - match.start() < 4: diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index e7463f8a0..0ebaf38f9 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -904,8 +904,6 @@ class File(BaseType): cfgdir = standarddir.config() assert cfgdir is not None value = os.path.join(cfgdir, value) - #if not self.required and not os.access(value, os.F_OK | os.R_OK): - # return None return value def validate(self, value):