escape search string, explicit boolean test

This commit is contained in:
Milan Svoboda 2015-12-26 23:44:03 +01:00
parent a652688566
commit 1f3a8a60d8

View File

@ -71,7 +71,7 @@ class CompletionFilterModel(QSortFilterProxyModel):
""" """
with debug.log_time(log.completion, 'Setting filter pattern'): with debug.log_time(log.completion, 'Setting filter pattern'):
self.pattern = val self.pattern = val
self.patternre = re.compile(val.casefold().replace(" ", ".*")) self.patternre = re.compile(re.escape(val.casefold()).replace("\ ", ".*"))
self.invalidateFilter() self.invalidateFilter()
sortcol = 0 sortcol = 0
try: try:
@ -149,8 +149,8 @@ class CompletionFilterModel(QSortFilterProxyModel):
data = self.srcmodel.data(idx) data = self.srcmodel.data(idx)
if not data: if not data:
continue continue
else: elif self.patternre.search(data.casefold()):
return self.patternre.search(data.casefold()) return True
return False return False
def intelligentLessThan(self, lindex, rindex): def intelligentLessThan(self, lindex, rindex):