]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
* src/insets/insetcommand.C: fix plaintext() output
[lyx.git] / src / text2.C
index a447565c380c160b6ff9a8c0203fb3be38f8bb3e..d27f5e1dbdb4fcdfe5b8580174c4e20014816fdd 100644 (file)
@@ -1246,6 +1246,8 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur,
 
 void LyXText::deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool trackChanges)
 {
+       BOOST_ASSERT(first >= 0 && first <= last && last < (int) pars_.size());
+
        for (pit_type pit = first; pit <= last; ++pit) {
                Paragraph & par = pars_[pit];
 
@@ -1262,8 +1264,9 @@ void LyXText::deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool
                        }
                }
 
-               // don't delete anything if this is the ONLY paragraph
-               if (pars_.size() == 1)
+               // don't delete anything if this is the only remaining paragraph within the given range
+               // note: LyXText::acceptOrRejectChanges() sets the cursor to 'first' after calling DEPM 
+               if (first == last)
                        continue;
 
                // don't delete empty paragraphs with keepempty set