* LFUN_BUFFER_RELOAD - allow dropping of the changes.

Useful in scripts.
This commit is contained in:
Pavel Sanda 2018-01-13 19:19:18 +01:00
parent e57b245d0b
commit 46826155a8
2 changed files with 6 additions and 2 deletions

View File

@ -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
*/

View File

@ -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()) {