forked from qt-creator/qt-creator
CppEditor: Fix highlighting in new split if file is changed externally
For a new split/editor no CppHighlightingSupport was set since
onMimeTypeChanged was not called.
Now the CppHighlightingSupport is set again in the constructor. This
reverts partly
commit 033ad887
C++: handle file type changes for choosing highlighters
Task-number: QTCREATORBUG-9382
Change-Id: Ie79d357d570bec4920366fbd56fb67859be9b37a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -115,10 +115,16 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor
|
||||
, m_cachedContentsEditorRevision(-1)
|
||||
, m_initialized(false)
|
||||
, m_lastHighlightRevision(0)
|
||||
, m_highlightingSupport(modelManager->highlightingSupport(textEditor))
|
||||
{
|
||||
connect(m_modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
|
||||
this, SLOT(onDocumentUpdated(CPlusPlus::Document::Ptr)));
|
||||
|
||||
if (m_highlightingSupport && m_highlightingSupport->requiresSemanticInfo()) {
|
||||
connect(this, SIGNAL(semanticInfoUpdated(CppTools::SemanticInfo)),
|
||||
this, SLOT(startHighlighting()));
|
||||
}
|
||||
|
||||
m_updateDocumentTimer = new QTimer(this);
|
||||
m_updateDocumentTimer->setSingleShot(true);
|
||||
m_updateDocumentTimer->setInterval(m_updateDocumentInterval);
|
||||
@@ -135,6 +141,8 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor
|
||||
|
||||
connect(m_textEditor->document(), SIGNAL(mimeTypeChanged()),
|
||||
this, SLOT(onMimeTypeChanged()));
|
||||
|
||||
updateDocument();
|
||||
}
|
||||
|
||||
CppEditorSupport::~CppEditorSupport()
|
||||
|
||||
Reference in New Issue
Block a user