rename patternre, use ignorecase in re instead of casefold
This commit is contained in:
parent
382f7c6bf1
commit
ec8dc35a68
@ -47,7 +47,7 @@ class CompletionFilterModel(QSortFilterProxyModel):
|
|||||||
super().setSourceModel(source)
|
super().setSourceModel(source)
|
||||||
self.srcmodel = source
|
self.srcmodel = source
|
||||||
self.pattern = ''
|
self.pattern = ''
|
||||||
self.patternre = None
|
self.pattern_re = None
|
||||||
|
|
||||||
dumb_sort = self.srcmodel.DUMB_SORT
|
dumb_sort = self.srcmodel.DUMB_SORT
|
||||||
if dumb_sort is None:
|
if dumb_sort is None:
|
||||||
@ -71,10 +71,9 @@ 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
|
||||||
val = val.casefold()
|
|
||||||
val = re.escape(val)
|
val = re.escape(val)
|
||||||
val = val.replace(r'\ ', r'.*')
|
val = val.replace(r'\ ', r'.*')
|
||||||
self.patternre = re.compile(val)
|
self.pattern_re = re.compile(val, re.IGNORECASE)
|
||||||
self.invalidateFilter()
|
self.invalidateFilter()
|
||||||
sortcol = 0
|
sortcol = 0
|
||||||
try:
|
try:
|
||||||
@ -152,7 +151,7 @@ class CompletionFilterModel(QSortFilterProxyModel):
|
|||||||
data = self.srcmodel.data(idx)
|
data = self.srcmodel.data(idx)
|
||||||
if not data:
|
if not data:
|
||||||
continue
|
continue
|
||||||
elif self.patternre.search(data.casefold()):
|
elif self.pattern_re.search(data):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user