forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/8.0'
Reverts/comments out parts of 45f93a817a,
which needs to be resolved in a follow-up commit.
Conflicts:
cmake/QtCreatorIDEBranding.cmake
qbs/modules/qtc/qtc.qbs
qtcreator_ide_branding.pri
share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
src/plugins/cmakeprojectmanager/cmakesettingspage.cpp
src/plugins/python/pythoneditor.cpp
src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
src/plugins/scxmleditor/common/colorsettings.cpp
Change-Id: I7f0f7b7120e75a9fc3a8886bc57c17345cbb501b
This commit is contained in:
@@ -283,7 +283,17 @@ public:
|
||||
QString m_displayName;
|
||||
LanguageFilter m_languagFilter;
|
||||
QJsonObject m_initializationOptions;
|
||||
QMap<TextEditor::TextDocument *, QString> m_openedDocument;
|
||||
class OpenedDocument
|
||||
{
|
||||
public:
|
||||
~OpenedDocument()
|
||||
{
|
||||
QObject::disconnect(contentsChangedConnection);
|
||||
}
|
||||
QMetaObject::Connection contentsChangedConnection;
|
||||
QString documentContents;
|
||||
};
|
||||
QMap<TextEditor::TextDocument *, OpenedDocument> m_openedDocument;
|
||||
|
||||
// Used for build system artifacts (e.g. UI headers) that Qt Creator "live-generates" ahead of
|
||||
// the build.
|
||||
@@ -618,11 +628,14 @@ void Client::openDocument(TextEditor::TextDocument *document)
|
||||
}
|
||||
}
|
||||
|
||||
d->m_openedDocument[document] = document->plainText();
|
||||
connect(document, &TextDocument::contentsChangedWithPosition, this,
|
||||
[this, document](int position, int charsRemoved, int charsAdded) {
|
||||
documentContentsChanged(document, position, charsRemoved, charsAdded);
|
||||
});
|
||||
d->m_openedDocument[document].documentContents = document->plainText();
|
||||
d->m_openedDocument[document].contentsChangedConnection
|
||||
= connect(document,
|
||||
&TextDocument::contentsChangedWithPosition,
|
||||
this,
|
||||
[this, document](int position, int charsRemoved, int charsAdded) {
|
||||
documentContentsChanged(document, position, charsRemoved, charsAdded);
|
||||
});
|
||||
if (!d->m_documentVersions.contains(filePath))
|
||||
d->m_documentVersions[filePath] = 0;
|
||||
d->sendOpenNotification(filePath, document->mimeType(), document->plainText(),
|
||||
@@ -1083,7 +1096,7 @@ void Client::documentContentsChanged(TextEditor::TextDocument *document,
|
||||
}
|
||||
}
|
||||
if (append) {
|
||||
QTextDocument oldDoc(d->m_openedDocument[document]);
|
||||
QTextDocument oldDoc(d->m_openedDocument[document].documentContents);
|
||||
QTextCursor cursor(&oldDoc);
|
||||
// Workaround https://bugreports.qt.io/browse/QTBUG-80662
|
||||
// The contentsChanged gives a character count that can be wrong for QTextCursor
|
||||
@@ -1104,7 +1117,7 @@ void Client::documentContentsChanged(TextEditor::TextDocument *document,
|
||||
d->m_documentsToUpdate[document] = {
|
||||
DidChangeTextDocumentParams::TextDocumentContentChangeEvent(document->plainText())};
|
||||
}
|
||||
d->m_openedDocument[document] = document->plainText();
|
||||
d->m_openedDocument[document].documentContents = document->plainText();
|
||||
}
|
||||
|
||||
++d->m_documentVersions[document->filePath()];
|
||||
@@ -1532,8 +1545,6 @@ bool ClientPrivate::reset()
|
||||
m_dynamicCapabilities.reset();
|
||||
if (m_diagnosticManager)
|
||||
m_diagnosticManager->clearDiagnostics();
|
||||
for (auto it = m_openedDocument.cbegin(); it != m_openedDocument.cend(); ++it)
|
||||
it.key()->disconnect(this);
|
||||
m_openedDocument.clear();
|
||||
// temporary container needed since m_resetAssistProvider is changed in resetAssistProviders
|
||||
for (TextEditor::TextDocument *document : m_resetAssistProvider.keys())
|
||||
@@ -1544,7 +1555,8 @@ bool ClientPrivate::reset()
|
||||
qDeleteAll(m_documentHighlightsTimer);
|
||||
m_documentHighlightsTimer.clear();
|
||||
m_progressManager.reset();
|
||||
m_shadowDocuments.clear();
|
||||
for (auto &doc : m_shadowDocuments)
|
||||
doc.second.clear();
|
||||
m_documentVersions.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user