]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph_funcs.cpp
Fix bug http://bugzilla.lyx.org/show_bug.cgi?id=5328
[lyx.git] / src / paragraph_funcs.cpp
index 625d258d7d7271e3ac5c82d4107f00d1864a5006..42b95330bff8075f4f664a66b9a59efd13c4dbf1 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "support/debug.h"
 
+#include "support/lassert.h"
 #include <boost/next_prior.hpp>
 
 using namespace std;
@@ -45,13 +46,7 @@ static bool moveItem(Paragraph & fromPar, pos_type fromPos,
                        // the inset is not in the paragraph any more
                        tmpInset = fromPar.releaseInset(fromPos);
                }
-
-               if (!toPar.insetAllowed(tmpInset->lyxCode())) {
-                       delete tmpInset;
-                       return false;
-               }
-
-               toPar.insertInset(toPos, tmpInset, tmpFont, tmpChange);
+               return toPar.insertInset(toPos, tmpInset, tmpFont, tmpChange);
        } else {
                fromPar.eraseChar(fromPos, false);
                toPar.insertChar(toPos, tmpChar, tmpFont, tmpChange);
@@ -73,10 +68,10 @@ void breakParagraph(BufferParams const & bparams,
        Paragraph & par = pars[par_offset];
 
        // remember to set the inset_owner
-       tmp->setInsetOwner(par.inInset());
+       tmp->setInsetOwner(&par.inInset());
        // without doing that we get a crash when typing <Return> at the
        // end of a paragraph
-       tmp->setEmptyOrDefaultLayout(bparams.documentClass());
+       tmp->setPlainOrDefaultLayout(bparams.documentClass());
 
        // layout stays the same with latex-environments
        if (keep_layout) {
@@ -141,7 +136,7 @@ void breakParagraph(BufferParams const & bparams,
                par.params().clear();
                // do not lose start of appendix marker (bug 4212)
                par.params().startOfAppendix(soa);
-               par.setEmptyOrDefaultLayout(bparams.documentClass());
+               par.setPlainOrDefaultLayout(bparams.documentClass());
        }
 
        // layout stays the same with latex-environments
@@ -161,9 +156,10 @@ void breakParagraphConservative(BufferParams const & bparams,
                                       Paragraph());
        Paragraph & par = pars[par_offset];
 
+       tmp.setInsetOwner(&par.inInset());
        tmp.makeSameLayout(par);
 
-       BOOST_ASSERT(pos <= par.size());
+       LASSERT(pos <= par.size(), /**/);
 
        if (pos < par.size()) {
                // move everything behind the break position to the new paragraph