escape search string, explicit boolean test
This commit is contained in:
parent
a652688566
commit
1f3a8a60d8
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user