fix lint, highlight properly

This commit is contained in:
Milan Svoboda 2015-12-30 15:32:40 +01:00
parent 1f3a8a60d8
commit 4caffccca6
2 changed files with 4 additions and 3 deletions

View File

@ -198,8 +198,8 @@ class CompletionItemDelegate(QStyledItemDelegate):
columns_to_filter = index.model().srcmodel.columns_to_filter columns_to_filter = index.model().srcmodel.columns_to_filter
if index.column() in columns_to_filter and pattern: if index.column() in columns_to_filter and pattern:
repl = r'<span class="highlight">\g<0></span>' repl = r'<span class="highlight">\g<0></span>'
text = re.sub(re.escape(pattern), repl, self._opt.text, text = re.sub(re.escape(pattern).replace(r'\ ', r'|'),
flags=re.IGNORECASE) repl, self._opt.text, flags=re.IGNORECASE)
self._doc.setHtml(text) self._doc.setHtml(text)
else: else:
self._doc.setPlainText(self._opt.text) self._doc.setPlainText(self._opt.text)

View File

@ -71,7 +71,8 @@ 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(re.escape(val.casefold()).replace("\ ", ".*")) self.patternre = re.compile(re.escape(val.casefold())
.replace(r'\ ', r'.*'))
self.invalidateFilter() self.invalidateFilter()
sortcol = 0 sortcol = 0
try: try: