From debe180872935e8d69e9f9fac493bf6b16cc66eb Mon Sep 17 00:00:00 2001
From: mae <qt-info@nokia.com>
Date: Tue, 6 Oct 2009 12:55:27 +0200
Subject: [PATCH] Fix restoring of editor state when loading a file

With the recent restructering of editor manager, the editor state
was restored while the editor was hidden, causing the editor to
ensure the visibility of the cursor when it is shown.
---
 src/plugins/coreplugin/editormanager/editormanager.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 32a786e0500..4b12f1deeac 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1146,10 +1146,12 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
         return 0;
     }
     addEditor(editor);
-    restoreEditorState(editor);
-    QApplication::restoreOverrideCursor();
 
-    return activateEditor(view, editor, flags);
+    IEditor *result= activateEditor(view, editor, flags);
+    if (editor == result)
+        restoreEditorState(editor);
+    QApplication::restoreOverrideCursor();
+    return result;
 }
 
 bool EditorManager::openExternalEditor(const QString &fileName, const QString &editorKind)
-- 
GitLab