C++: prevent possibly highlighting a document twice

Possible when the highlighter does not need semantic info to run, and is
started through onDocumentUpdated() and updateDocumentNow().

Change-Id: I720299730213ac196143a273fb60cee8e43111f1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2013-11-27 14:49:48 +01:00
parent 7620be4a69
commit af2900ce72

View File

@@ -392,10 +392,14 @@ void CppEditorSupport::startHighlighting()
m_lastHighlightRevision = revision;
emit highlighterStarted(&m_highlighter, m_lastHighlightRevision);
} else {
const unsigned revision = currentSource(false).revision;
if (m_lastHighlightRevision == revision)
return;
m_lastHighlightRevision = revision;
static const Document::Ptr dummyDoc;
static const Snapshot dummySnapshot;
m_highlighter = m_highlightingSupport->highlightingFuture(dummyDoc, dummySnapshot);
m_lastHighlightRevision = editorRevision();
emit highlighterStarted(&m_highlighter, m_lastHighlightRevision);
}
}