commit 46826155a84e7cd21015526f6ed5421b8339e398
Author: Pavel Sanda <[email protected]>
Date: Sat Jan 13 19:19:18 2018 +0100
* LFUN_BUFFER_RELOAD - allow dropping of the changes.
Useful in scripts.
---
src/LyXAction.cpp | 3 ++-
src/frontends/qt4/GuiView.cpp | 5 ++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 958ef89..e37bf9a 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -742,7 +742,8 @@ void LyXAction::init()
/*!
* \var lyx::FuncCode lyx::LFUN_BUFFER_RELOAD
* \li Action: Reverts opened document.
- * \li Syntax: buffer-reload
+ * \li Syntax: buffer-reload [dump]
+ * \li Params: dump: do not ask for any confirmation, just reload. All changes
will be lost.
* \li Origin: Asger, 2 Feb 1997
* \endvar
*/
diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index e6e053f..9086464 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -3845,8 +3845,11 @@ void GuiView::dispatch(FuncRequest const & cmd,
DispatchResult & dr)
case LFUN_BUFFER_RELOAD: {
LASSERT(doc_buffer, break);
+ //drop changes?
+ bool drop = (cmd.argument()=="dump");
+
int ret = 0;
- if (!doc_buffer->isClean()) {
+ if (!drop && !doc_buffer->isClean()) {
docstring const file =
makeDisplayPath(doc_buffer->absFileName(), 20);
if (doc_buffer->notifiesExternalModification())
{