completion: Only mark in first column

This commit is contained in:
Florian Bruhin 2014-01-28 07:53:05 +01:00
parent 5027930018
commit 69e972e275

View File

@ -247,16 +247,17 @@ class CompletionItemDelegate(QStyledItemDelegate):
""") """)
doc.setDocumentMargin(0) doc.setDocumentMargin(0)
marks = index.data(Qt.UserRole) if index.column() == 0:
for mark in marks: marks = index.data(Qt.UserRole)
cur = QTextCursor(doc) for mark in marks:
cur.setPosition(mark[0]) cur = QTextCursor(doc)
cur.setPosition(mark[1], QTextCursor.KeepAnchor) cur.setPosition(mark[0])
txt = cur.selectedText() cur.setPosition(mark[1], QTextCursor.KeepAnchor)
cur.removeSelectedText() txt = cur.selectedText()
# FIXME escape html in txt cur.removeSelectedText()
cur.insertHtml('<span class="highlight">{}</span>'.format( # FIXME escape html in txt
html.escape(txt))) cur.insertHtml('<span class="highlight">{}</span>'.format(
html.escape(txt)))
doc.drawContents(self.painter, clip) doc.drawContents(self.painter, clip)
# FIXME we probably should do eliding here. See # FIXME we probably should do eliding here. See