Added highlighting for completion in name column.

This commit is contained in:
Antoni Boucher 2015-06-01 17:55:09 -04:00
parent 9582162927
commit 5085844550

View File

@ -196,13 +196,10 @@ class CompletionItemDelegate(QStyledItemDelegate):
if index.parent().isValid():
pattern = index.model().pattern
if index.column() == 0 and pattern:
repl = r'<span class="highlight">\g<0></span>'
text = re.sub(re.escape(pattern), repl, self._opt.text,
flags=re.IGNORECASE)
self._doc.setHtml(text)
else:
self._doc.setPlainText(self._opt.text)
repl = r'<span class="highlight">\g<0></span>'
text = re.sub(re.escape(pattern), repl, self._opt.text,
flags=re.IGNORECASE)
self._doc.setHtml(text)
else:
self._doc.setHtml('<b>{}</b>'.format(html.escape(self._opt.text)))