Auto-open first document on new project (#1219)

This commit is contained in:
Veronica Berglyd Olsen
2022-11-01 19:15:32 +01:00
parent 9dd1a60629
commit a2f92c1223
+7
View File
@@ -534,7 +534,14 @@ class GuiMain(QMainWindow):
self._updateStatusWordCount()
# Restore previously open documents, if any
# If none was recorded, open the first document found
lastEdited = self.theProject.data.getLastHandle("editor")
if lastEdited is None:
for nwItem in self.theProject.tree:
if nwItem and nwItem.isFileType():
lastEdited = nwItem.itemHandle
break
if lastEdited is not None:
self.openDocument(lastEdited, doScroll=True)