The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 467422f9df784e2e6bab4f0cc8fcfbc166c59bd4 Author: Jean-Marc Lasgouttes <[email protected]> Date: Wed Jul 18 10:31:47 2012 +0200 Do not kill the undo stack when doing a Save As... The code does a reload on the buffer to avoid loose pointers if the file changes directory. This commit adds a bool parameter to Buffer::reload to allow for keeping the undo stack intact. This is of couse only wanted in this case, not when reloading an earlier version of the file. diff --git a/src/Buffer.cpp b/src/Buffer.cpp index f2c3501..28bca5b 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -4580,7 +4580,7 @@ int Buffer::charCount(bool with_blanks) const } -Buffer::ReadStatus Buffer::reload() +Buffer::ReadStatus Buffer::reload(bool clearUndo) { setBusy(true); // c.f. bug http://www.lyx.org/trac/ticket/6587 @@ -4598,7 +4598,8 @@ Buffer::ReadStatus Buffer::reload() updateTitles(); markClean(); message(bformat(_("Document %1$s reloaded."), disp_fn)); - d->undo_.clear(); + if (clearUndo) + d->undo_.clear(); } else { message(bformat(_("Could not reload document %1$s."), disp_fn)); } diff --git a/src/Buffer.h b/src/Buffer.h index fc02c6a..f13a879 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -225,7 +225,8 @@ public: /// read a new document from a string bool readString(std::string const &); /// Reloads the LyX file - ReadStatus reload(); + /// \param clearUndo if false, leave alone the undo stack. + ReadStatus reload(bool clearUndo = true); //FIXME: The following function should be private //private: /// read the header, returns number of unknown tokens diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 52a4379..0237cb8 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2320,7 +2320,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname) bool const saved = saveBuffer(b, fname); if (saved) - b.reload(); + b.reload(false); return saved; } ----------------------------------------------------------------------- Summary of changes: src/Buffer.cpp | 5 +++-- src/Buffer.h | 3 ++- src/frontends/qt4/GuiView.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) hooks/post-receive -- The LyX Source Repository
