[LyX/master] Fix bug #12819.

Richard Kimberly Heck rikiheck at lyx.org
Thu Jul 27 20:59:44 UTC 2023


commit 5b2b0d5c76cf2dddeed963726234bcf06f91f449
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Thu Jul 27 18:12:54 2023 -0400

    Fix bug #12819.
    
    Pop a warning and mark the buffer dirty if the file is deleted from disk.
---
 src/Buffer.cpp |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 1f90df3..3d3bb53 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -5711,15 +5711,24 @@ void Buffer::Impl::fileExternallyModified(bool const exists)
 		       "checksum unchanged: " << filename);
 		return;
 	}
+	lyx_clean = false;
 	// If the file has been deleted, only mark the file as dirty since it is
 	// pointless to prompt for reloading. If later a file is moved into this
 	// location, then the externally modified warning will appear then.
 	if (exists)
-			externally_modified_ = true;
+		externally_modified_ = true;
 	// Update external modification notification.
 	// Dirty buffers must be visible at all times.
-	if (wa_ && wa_->unhide(owner_))
+	if (wa_ && wa_->unhide(owner_)) {
 		wa_->updateTitles();
+		if (!exists) {
+			frontend::Alert::warning(
+				_("File deleted from disk"),
+				bformat(_("The file\n  %1$s\n"
+					   "has been deleted from disk!"),
+					from_utf8(filename.absFileName())));
+		}
+	}
 	else
 		// Unable to unhide the buffer (e.g. no GUI or not current View)
 		lyx_clean = true;


More information about the lyx-cvs mailing list