eric7/QScintilla/Editor.py

branch
eric7-maintenance
changeset 9241
d23e9854aea4
parent 9200
709ff2ffed4d
diff -r 709ff2ffed4d -r d23e9854aea4 eric7/QScintilla/Editor.py
--- a/eric7/QScintilla/Editor.py	Sat Jul 02 17:22:06 2022 +0200
+++ b/eric7/QScintilla/Editor.py	Sun Jul 03 18:09:29 2022 +0200
@@ -1970,7 +1970,7 @@
         
         @param m modification status
         """
-        if not m and bool(self.fileName):
+        if not m and bool(self.fileName) and pathlib.Path(self.fileName).exists():
             self.lastModified = pathlib.Path(self.fileName).stat().st_mtime
         self.modificationStatusChanged.emit(m, self)
         self.undoAvailable.emit(self.isUndoAvailable())
@@ -3496,7 +3496,11 @@
             self.__checkEncoding()
             return True
         else:
-            self.lastModified = pathlib.Path(fn).stat().st_mtime
+            self.lastModified = (
+                pathlib.Path(fn).stat().st_mtime
+                if pathlib.Path(fn).exists() else
+                0
+            )
             return False
         
     def saveFileAs(self, path=None, toProject=False):
@@ -7086,6 +7090,7 @@
         if (
             self.vm.editorsCheckFocusInEnabled() and
             not self.inReopenPrompt and self.fileName and
+            pathlib.Path(self.fileName).exists() and
             pathlib.Path(self.fileName).stat().st_mtime != self.lastModified
         ):
             self.inReopenPrompt = True

eric ide

mercurial