fixed when new hints are prefixes of existing
good thing I used this some days before any merging
This commit is contained in:
parent
1dfcf99d22
commit
766a94a539
@ -268,16 +268,15 @@ class HintManager(QObject):
|
|||||||
if not match: continue
|
if not match: continue
|
||||||
yield candidate[match.start():match.end()].lower()
|
yield candidate[match.start():match.end()].lower()
|
||||||
|
|
||||||
def is_prefix(hint, existing):
|
def any_prefix(hint, existing):
|
||||||
return set(hint[:i+1] for i in range(len(hint))) & set(existing)
|
return any(hint.startswith(e) or e.startswith(hint) for e in existing)
|
||||||
|
|
||||||
def first_good_hint(new, existing):
|
def first_good_hint(new, existing):
|
||||||
for hint in new:
|
for hint in new:
|
||||||
# some none's
|
# some none's
|
||||||
if not hint: continue
|
if not hint: continue
|
||||||
if len(hint) < 3: continue
|
if len(hint) < 3: continue
|
||||||
# not a prefix of an existing hint
|
if any_prefix(hint, existing): continue
|
||||||
if set(hint[:i+1] for i in range(len(hint))) & set(existing): continue
|
|
||||||
return hint
|
return hint
|
||||||
|
|
||||||
hints = []
|
hints = []
|
||||||
|
Loading…
Reference in New Issue
Block a user