When my file is modified externally and I select
   File->Revert to Saved
I get the following warning.
   "Any changes will be lost. Are you sure you want to revert to the
saved version
of the document ..."

I get this warning even when the buffer is clean so there are no
changes to be lost. I would not expect to get this warning when the
Buffer is clean because:
1) when the Buffer is clean, at best the warning forces me to waste a
mouse click.
2) Typically it forces me to stop and think "Do I really have unsaved changes"?
3) At worst it is "Crying wolf" so when I finally do accidentally
select Revert to Saved when I have unsaved changes I will select
"Revert" without thinking.

How does the attached patch against trunk look?

Note that this is the same as the patch below except that it has been
reformatted to fit in 80 columns. I have been using the patch below
for 8 months without noticing any regressions.
  http://www.lyx.org/trac/attachment/ticket/6550/GuiView.patch

I trust that reformatting the presentation of the text does not
require a re-translation?
I.e _("aa") vs. _("a" "a")

-- 
John C. McCabe-Dansted
Index: frontends/qt4/GuiView.cpp
===================================================================
--- frontends/qt4/GuiView.cpp	(revision 35426)
+++ frontends/qt4/GuiView.cpp	(working copy)
@@ -3036,11 +3036,21 @@
 
 		case LFUN_BUFFER_RELOAD: {
 			LASSERT(doc_buffer, break);
-			docstring const file = makeDisplayPath(doc_buffer->absFileName(), 20);
-			docstring text = bformat(_("Any changes will be lost. Are you sure "
-								 "you want to revert to the saved version of the document %1$s?"), file);
-			int const ret = Alert::prompt(_("Revert to saved document?"),
-				text, 1, 1, _("&Revert"), _("&Cancel"));
+			int ret;
+			
+			if (doc_buffer->isClean()) {
+				ret = 0;
+			} else {
+				docstring const file = makeDisplayPath(
+					doc_buffer->absFileName(), 20);
+				docstring text = bformat(_(
+					"Any changes will be lost. Are you sure"
+					" you want to revert to the saved "
+					"version of the document %1$s?"), file);
+				ret = Alert::prompt(
+					_("Revert to saved document?"),
+					text, 1, 1, _("&Revert"), _("&Cancel"));
+			}
 
 			if (ret == 0) {
 				doc_buffer->markClean();

Reply via email to