Skip to content
Snippets Groups Projects
Commit 18d84955 authored by mae's avatar mae
Browse files

load the current editor first when restoring, less flicker, plus the focus is

in the right editor from the start
parent 5b8cff20
No related branches found
No related tags found
No related merge requests found
...@@ -268,16 +268,14 @@ bool EditorGroup::restoreState(const QByteArray &state) ...@@ -268,16 +268,14 @@ bool EditorGroup::restoreState(const QByteArray &state)
EditorManager *em = EditorManager::instance(); EditorManager *em = EditorManager::instance();
EditorList editors; EditorList editors;
in >> editors; in >> editors;
IEditor *currentEditor = 0;
IEditor *editor;
int savedIndex = editors.currentEditorIndex; 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) { for (int j = 0; j < editors.count(); ++j) {
editor = em->restoreEditor(editors.fileNameAt(j), editors.editorKindAt(j), this);
if (j == savedIndex) if (j == savedIndex)
currentEditor = editor; continue;
em->restoreEditor(editors.fileNameAt(j), editors.editorKindAt(j), this);
} }
if (currentEditor)
setCurrentEditor(currentEditor);
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment