fix remarks

This commit is contained in:
Felix Van der Jeugt 2016-01-05 22:45:52 +01:00
parent 8873aba09f
commit 362db3d986
2 changed files with 6 additions and 9 deletions

View File

@ -683,7 +683,7 @@ class HintManager(QObject):
keyparsers = objreg.get('keyparsers', scope='window', keyparsers = objreg.get('keyparsers', scope='window',
window=self._win_id) window=self._win_id)
keyparser = keyparsers[usertypes.KeyMode.hint] keyparser = keyparsers[usertypes.KeyMode.hint]
keyparser.update_bindings(strings) keyparser.update_bindings(hints)
def follow_prevnext(self, frame, baseurl, prev=False, tab=False, def follow_prevnext(self, frame, baseurl, prev=False, tab=False,
background=False, window=False): background=False, window=False):
@ -981,14 +981,11 @@ class WordHinter:
"""Generator for word hints. """Generator for word hints.
Class attributes:
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): def __init__(self):
# will be initialized on first use. # will be initialized on first use.
self.words = set() self.words = set()
@ -1007,8 +1004,10 @@ class WordHinter:
# contains none-alphabetic chars # contains none-alphabetic chars
continue continue
if len(word) > 4: if len(word) > 4:
# we don't need words longer than 4
continue continue
for i in range(len(word)): for i in range(len(word)):
# remove all prefixes of this word
hints.discard(word[:i + 1]) hints.discard(word[:i + 1])
hints.add(word) hints.add(word)
self.words.update(hints) self.words.update(hints)
@ -1044,7 +1043,7 @@ class WordHinter:
for candidate in words: for candidate in words:
if not candidate: if not candidate:
continue continue
match = self.FIRST_ALPHABETIC.search(candidate) match = re.search('[A-Za-z]{3,}', candidate)
if not match: if not match:
continue continue
if match.end() - match.start() < 4: if match.end() - match.start() < 4:

View File

@ -904,8 +904,6 @@ class File(BaseType):
cfgdir = standarddir.config() cfgdir = standarddir.config()
assert cfgdir is not None assert cfgdir is not None
value = os.path.join(cfgdir, value) 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 return value
def validate(self, value): def validate(self, value):