From af2900ce724f5bb8be7d7ea19c179e10dcafdcab Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 27 Nov 2013 14:49:48 +0100 Subject: 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 --- src/plugins/cpptools/cpptoolseditorsupport.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/plugins/cpptools/cpptoolseditorsupport.cpp') diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp index 85c304cad6..fca1a8402f 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.cpp +++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp @@ -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); } } -- cgit v1.2.1 From 890f72160c61507b4bf85bdf4502d63a32f762d0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 9 Dec 2013 16:14:55 +0100 Subject: Rename QString ITextEditorDocument::contents --> plainText To differentiate it from the byte array based IDocument::setContents Change-Id: Icc9600732c2742fb79254a0697870bacce3a59ee Reviewed-by: David Schulz --- src/plugins/cpptools/cpptoolseditorsupport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/cpptools/cpptoolseditorsupport.cpp') diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp index fca1a8402f..c2a3792c93 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.cpp +++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp @@ -186,7 +186,7 @@ QByteArray CppEditorSupport::contents() const const int editorRev = editorRevision(); if (m_cachedContentsEditorRevision != editorRev && !m_fileIsBeingReloaded) { m_cachedContentsEditorRevision = editorRev; - m_cachedContents = m_textEditor->textDocument()->contents().toUtf8(); + m_cachedContents = m_textEditor->textDocument()->plainText().toUtf8(); } return m_cachedContents; -- cgit v1.2.1