From 7eb09ff0b7195665b8de193d200b0ca2ea21b7bf Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 7 May 2024 13:50:56 +0200 Subject: [PATCH] Editors: Update navigation history when closing with the tool button The code path for the global actions (File menu, shortcut) were adding the closed document to the history, but the editor view local action did not. Move the call one level deeper, so it is done for both. That fixes Window > Go Back under some circumstances in which it didn't open closed files again. Change-Id: I74bdb02209b8ac7bb7714d9a827e3a0c30a4c9e9 Reviewed-by: Marcus Tillmanns --- src/plugins/coreplugin/editormanager/editormanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 6ec37a6cb8c..bd9b2620670 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1473,6 +1473,7 @@ bool EditorManagerPrivate::activateEditorForEntry(EditorView *view, DocumentMode void EditorManagerPrivate::closeEditorOrDocument(IEditor *editor) { QTC_ASSERT(editor, return); + EditorManager::addCurrentPositionToNavigationHistory(); QList visible = EditorManager::visibleEditors(); if (Utils::contains(visible, [&editor](IEditor *other) { @@ -2690,7 +2691,6 @@ void EditorManager::slotCloseCurrentEditorOrDocument() { if (!d->m_currentEditor) return; - addCurrentPositionToNavigationHistory(); d->closeEditorOrDocument(d->m_currentEditor); }