The branch, 2.0.x, has been updated. - Log -----------------------------------------------------------------
commit 824fe175112559af42fc42da889a60dc7ee465d1 Author: Jean-Marc Lasgouttes <[email protected]> Date: Tue Aug 21 12:19:18 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 061f00b..c9d9e6b 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -4419,8 +4419,8 @@ int Buffer::charCount(bool with_blanks) const { return d->charCount(with_blanks); } - -Buffer::ReadStatus Buffer::reload() + +Buffer::ReadStatus Buffer::reload(bool clearUndo) { setBusy(true); // c.f. bug http://www.lyx.org/trac/ticket/6587 @@ -4438,7 +4438,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 410cb97..c8cf926 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -209,7 +209,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 f339119..ac9061f 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2294,7 +2294,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname) bool const saved = saveBuffer(b, fname); if (saved) - b.reload(); + b.reload(false); return saved; } diff --git a/status.20x b/status.20x index d15a55e..f372581 100644 --- a/status.20x +++ b/status.20x @@ -118,6 +118,8 @@ What's new - Make sure that undo restores paragraph longest label width correctly (bug 8242). +- Do not forget the undo information when doing a Save As... + - Replace current selection when pasting (bug 8027). - Fix enumitem module translation (bug #8201). ----------------------------------------------------------------------- Summary of changes: src/Buffer.cpp | 7 ++++--- src/Buffer.h | 3 ++- src/frontends/qt4/GuiView.cpp | 2 +- status.20x | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) hooks/post-receive -- The LyX Source Repository
