--- a/src/eric7/ViewManager/ViewManager.py Sat Dec 10 16:59:48 2022 +0100 +++ b/src/eric7/ViewManager/ViewManager.py Sat Dec 10 17:56:44 2022 +0100 @@ -5373,23 +5373,26 @@ # Open up the new files. self.openSourceFile(prog) - def checkDirty(self, editor, autosave=False): + def checkDirty(self, editor, autosave=False, closeIt=False): """ Public method to check the dirty status and open a message window. @param editor editor window to check @type Editor @param autosave flag indicating that the file should be saved - automatically - @type bool + automatically (defaults to False) + @type bool (optional) + @param closeIt flag indicating a check in order to close the editor + (defaults to False) + @type bool (optional) @return flag indicating successful reset of the dirty flag @rtype bool """ if editor.isModified(): fn = editor.getFileName() # ignore the dirty status, if there is more than one open editor - # for the same file - if fn and self.getOpenEditorCount(fn) > 1 and not autosave: + # for the same file (only for closing) + if fn and self.getOpenEditorCount(fn) > 1 and closeIt: return True if fn is None: @@ -5463,7 +5466,7 @@ @rtype bool """ # save file if necessary - if not ignoreDirty and not self.checkDirty(editor): + if not ignoreDirty and not self.checkDirty(editor, closeIt=True): return False # get the filename of the editor for later use @@ -5733,6 +5736,9 @@ self.editorOpened.emit(fn) self.editorOpenedEd.emit(editor) + if caller.isModified(): + editor.setModified(True) + return editor, assembly def addToRecentList(self, fn):