]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph_funcs.cpp
Fix bug #5540: Crash in MathAtom on Undo.
[lyx.git] / src / paragraph_funcs.cpp
index a11d72550e48f113195b2a641e66eceec5490bb1..0459ed79117dcef4dbdddd46935e9b637735bd2e 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -305,6 +305,20 @@ Font const outerFont(pit_type par_offset, ParagraphList const & pars)
 }
 
 
+bool isFullyDeleted(ParagraphList const & pars)
+{
+       pit_type const pars_size = static_cast<pit_type>(pars.size());
+
+       // check all paragraphs
+       for (pit_type pit = 0; pit < pars_size; ++pit) {
+               if (!pars[pit].empty())   // prevent assertion failure
+                       if (!pars[pit].isFullyDeleted(0, pars[pit].size()))
+                               return false;
+       }
+       return true;
+}
+
+
 void acceptChanges(ParagraphList & pars, BufferParams const & bparams)
 {
        pit_type pars_size = static_cast<pit_type>(pars.size());