The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit e3854bb59b98ee4f7514cf2ca5585cb6be949186
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Mon May 21 00:11:23 2012 +0200

    Tentative fix to #8159: Undo doesn't restore environment depth correctly
    
    The undo range is extended to encompass all the paragraph after the end that
    are a non-zero depth. The reason is that these paragraphs may see their 
depth
    reduced if the last paragraph sees its depth reduced.
    
    Note that there is a memory cost, since we store paragraphs than may not be
    modified in practice. This may matter for some pathological files (people
    putting all their document at depth 1 for a weird reason?)
    
    I tried to be careful, but this can introduce new bugs. Please test.

diff --git a/src/Undo.cpp b/src/Undo.cpp
index 28438c1..a80c01c 100644
--- a/src/Undo.cpp
+++ b/src/Undo.cpp
@@ -23,6 +23,7 @@
 #include "DocIterator.h"
 #include "Paragraph.h"
 #include "ParagraphList.h"
+#include "ParagraphParameters.h"
 #include "Text.h"
 
 #include "mathed/MathSupport.h"
@@ -344,6 +345,15 @@ void Undo::Private::doRecordUndo(UndoKind kind,
                advance(first, first_pit);
                ParagraphList::const_iterator last = plist.begin();
                advance(last, last_pit + 1);
+               // If the paragraphs after the last one have a
+               // non-zero depth and the depth of last paragraph is
+               // decremented, then these paragraphs may be affected
+               // (ticket #8159). We guard against that by saving
+               // these extra paragraphs.
+               while (last != plist.end() && last->params().depth() > 0) {
+                       ++last;
+                       --undo.end;
+               }
                undo.pars = new ParagraphList(first, last);
        }
 

-----------------------------------------------------------------------

Summary of changes:
 src/Undo.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to