Commit 4da9c3e0 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Don't reuse untitled doc when opening a new doc

With the previous change `viewChanged` doesn't get emitted when we open
a new doc in an empty(only untitled doc) instance. This leads to
problems such as LSP not kicking in on time.
parent 294c3a17
......@@ -161,14 +161,11 @@ KTextEditor::Document *KateDocManager::openUrl(const QUrl &url, const QString &e
if (!doc) {
if (untitledDoc) {
// reuse the untitled document which is not needed
auto &info = m_docInfos.find(untitledDoc).value();
delete info;
info = new KateDocumentInfo(docInfo);
doc = untitledDoc;
} else {
doc = createDoc(docInfo);
QTimer::singleShot(0, untitledDoc, [this, untitledDoc] {
doc = createDoc(docInfo);
if (!encoding.isEmpty()) {
......@@ -265,10 +262,7 @@ bool KateDocManager::closeDocument(KTextEditor::Document *doc, bool closeUrl)
return false;
QList<KTextEditor::Document *> documents;
return closeDocuments(documents, closeUrl);
return closeDocuments({doc}, closeUrl);
bool KateDocManager::closeDocumentList(const QList<KTextEditor::Document *> &documents)
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