From 18d84955f7c35a38fac504eec9362f559c43e2fc Mon Sep 17 00:00:00 2001
From: mae <qtc-committer@nokia.com>
Date: Fri, 12 Dec 2008 13:25:43 +0100
Subject: [PATCH] load the current editor first when restoring, less flicker,
 plus the focus is in the right editor from the start

---
 src/plugins/coreplugin/editormanager/editorgroup.cpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/plugins/coreplugin/editormanager/editorgroup.cpp b/src/plugins/coreplugin/editormanager/editorgroup.cpp
index c146a09f256..2e33f810e03 100644
--- a/src/plugins/coreplugin/editormanager/editorgroup.cpp
+++ b/src/plugins/coreplugin/editormanager/editorgroup.cpp
@@ -268,16 +268,14 @@ bool EditorGroup::restoreState(const QByteArray &state)
     EditorManager *em = EditorManager::instance();
     EditorList editors;
     in >> editors;
-    IEditor *currentEditor = 0;
-    IEditor *editor;
     int savedIndex = editors.currentEditorIndex;
+    if (savedIndex >= 0 && savedIndex < editors.count())
+        em->restoreEditor(editors.fileNameAt(savedIndex), editors.editorKindAt(savedIndex), this);
     for (int j = 0; j < editors.count(); ++j) {
-        editor = em->restoreEditor(editors.fileNameAt(j), editors.editorKindAt(j), this);
         if (j == savedIndex)
-            currentEditor = editor;
+            continue;
+        em->restoreEditor(editors.fileNameAt(j), editors.editorKindAt(j), this);
     }
-    if (currentEditor)
-        setCurrentEditor(currentEditor);
     return true;
 }
 
-- 
GitLab