summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/editormanager
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-02-14 12:34:14 +0100
committerEike Ziller <eike.ziller@qt.io>2018-02-16 08:32:34 +0000
commit324de13b4e6703db778010d0682ac26cff359516 (patch)
treeed2d9a4f615e40535d80a6b0e90025003e0f9271 /src/plugins/coreplugin/editormanager
parent3060ddbcf30ebacdafa5a6be02634485944e38a9 (diff)
downloadqt-creator-324de13b4e6703db778010d0682ac26cff359516.tar.gz
Fix ordering of items in open documents popup
When the document history was updated, it was cleaned of any items which no longer had a document open for them. This worked fine when that only happened when user closed documents. Nowadays this also happens when suspending documents without user interaction. Only remove items from the document history if they are no longer available even as a suspended document. Task-number: QTCREATORBUG-19758 Change-Id: I131a24823b5c456879b67a35b039768a15bd7716 Reviewed-by: Konstantin Tokarev <annulen@yandex.ru> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/editormanager')
-rw-r--r--src/plugins/coreplugin/editormanager/documentmodel.cpp5
-rw-r--r--src/plugins/coreplugin/editormanager/documentmodel.h1
-rw-r--r--src/plugins/coreplugin/editormanager/editorview.cpp7
3 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/coreplugin/editormanager/documentmodel.cpp b/src/plugins/coreplugin/editormanager/documentmodel.cpp
index 7aa24d4c85..fae56815ca 100644
--- a/src/plugins/coreplugin/editormanager/documentmodel.cpp
+++ b/src/plugins/coreplugin/editormanager/documentmodel.cpp
@@ -517,6 +517,11 @@ Utils::optional<int> DocumentModel::indexOfDocument(IDocument *document)
return d->indexOfDocument(document);
}
+Utils::optional<int> DocumentModel::indexOfFilePath(const Utils::FileName &filePath)
+{
+ return d->indexOfFilePath(filePath);
+}
+
DocumentModel::Entry *DocumentModel::entryForDocument(IDocument *document)
{
return Utils::findOrDefault(d->m_entries,
diff --git a/src/plugins/coreplugin/editormanager/documentmodel.h b/src/plugins/coreplugin/editormanager/documentmodel.h
index 73e75f71ca..09bb465272 100644
--- a/src/plugins/coreplugin/editormanager/documentmodel.h
+++ b/src/plugins/coreplugin/editormanager/documentmodel.h
@@ -69,6 +69,7 @@ public:
static int entryCount();
static QList<Entry *> entries();
static Utils::optional<int> indexOfDocument(IDocument *document);
+ static Utils::optional<int> indexOfFilePath(const Utils::FileName &filePath);
static Entry *entryForDocument(IDocument *document);
static Entry *entryForFilePath(const Utils::FileName &filePath);
static QList<IDocument *> openedDocuments();
diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp
index b46c71f772..4d6dc67623 100644
--- a/src/plugins/coreplugin/editormanager/editorview.cpp
+++ b/src/plugins/coreplugin/editormanager/editorview.cpp
@@ -268,11 +268,10 @@ void EditorView::updateEditorHistory(IEditor *editor, QList<EditLocation> &histo
location.state = QVariant(state);
for (int i = 0; i < history.size(); ++i) {
- if (history.at(i).document == 0
- || history.at(i).document == document
- ){
+ const EditLocation &item = history.at(i);
+ if (item.document == document
+ || !DocumentModel::indexOfFilePath(FileName::fromString(item.fileName))) {
history.removeAt(i--);
- continue;
}
}
history.prepend(location);