Commit af2900ce authored by Erik Verbruggen's avatar Erik Verbruggen

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: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 7620be4a
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment