]> git.lyx.org Git - lyx.git/blobdiff - src/Text2.cpp
Fix memory leak.
[lyx.git] / src / Text2.cpp
index 4c47d0811f6c66f8b956755fe9390d0a78f0ea33..15a64b0b5ce03b08d8985495e24b5738bc1bac9a 100644 (file)
@@ -37,6 +37,7 @@
 #include "FuncRequest.h"
 #include "gettext.h"
 #include "Language.h"
+#include "Layout.h"
 #include "Lexer.h"
 #include "LyXFunc.h"
 #include "LyXRC.h"
@@ -58,6 +59,7 @@
 #include "support/textutils.h"
 
 #include <boost/current_function.hpp>
+#include <boost/next_prior.hpp>
 
 #include <sstream>
 
@@ -636,7 +638,7 @@ bool Text::cursorLeft(Cursor & cur)
 
        // move to the previous paragraph or do nothing
        if (cur.pit() > 0)
-               return setCursor(cur, cur.pit() - 1, getPar(cur.pit() - 1).size());
+               return setCursor(cur, cur.pit() - 1, getPar(cur.pit() - 1).size(), true, false);
        return false;
 }
 
@@ -693,7 +695,7 @@ bool Text::cursorRight(Cursor & cur)
 
        // move to next paragraph
        if (cur.pit() != cur.lastpit())
-               return setCursor(cur, cur.pit() + 1, 0);
+               return setCursor(cur, cur.pit() + 1, 0, true, false);
        return false;
 }
 
@@ -813,7 +815,11 @@ bool Text::deleteEmptyParagraphMechanism(Cursor & cur,
                           max(old.pit() - 1, pit_type(0)),
                           min(old.pit() + 1, old.lastpit()));
                ParagraphList & plist = old.text()->paragraphs();
+               bool const soa = oldpar.params().startOfAppendix();
                plist.erase(boost::next(plist.begin(), old.pit()));
+               // do not lose start of appendix marker (bug 4212)
+               if (soa)
+                       plist[old.pit()].params().startOfAppendix(true);
 
                // see #warning (FIXME?) above 
                if (cur.depth() >= old.depth()) {