Use smartcase in search.

This commit is contained in:
Jonathan Lestrelin 2018-03-15 01:24:48 +01:00
parent b114257bdd
commit d16c92c681

View File

@ -97,8 +97,12 @@ class SearchPassService(dbus.service.Object):
if filename[-4:] != '.gpg':
continue
path = path_join(dir_path, filename)[:-4]
for name in path.split('/'):
matcher.set_seq1(name)
for part in path.split('/'):
# smartcase: be case insensitive unless uppercase
# characters are used in the search
if name.islower():
part = part.lower()
matcher.set_seq1(part)
score = matcher.ratio()
if score >= 0.5 and \
(path not in matches or score > matches[path]):