]> git.lyx.org Git - lyx.git/blobdiff - src/dociterator.C
reduce number of calls to LyXText::getFont
[lyx.git] / src / dociterator.C
index b4fd5c2218892b23fc26617c782ea0f2451d8137..53a0d2ebc77b9c749c1869c06d1c9aa5f5d2a213 100644 (file)
@@ -22,6 +22,7 @@
 #include "mathed/math_inset.h"
 
 #include <boost/assert.hpp>
+#include <boost/current_function.hpp>
 
 using std::endl;
 
@@ -138,7 +139,7 @@ LyXText const * DocIterator::text() const
 
 Paragraph & DocIterator::paragraph()
 {
-       if (!inTexted()) 
+       if (!inTexted())
                lyxerr << *this << endl;
        BOOST_ASSERT(inTexted());
        return top().paragraph();
@@ -382,8 +383,27 @@ void DocIterator::forwardPosNoDescend()
 void DocIterator::forwardPar()
 {
        forwardPos();
-       while (!empty() && (!inTexted() || pos() != 0))
+
+#if 0
+       DocIterator cmp(*this);
+#endif
+
+       while (!empty() && (!inTexted() || pos() != 0)) {
+               if (inTexted()) {
+                       pos_type const lastp = lastpos();
+                       Paragraph const & par = paragraph();
+                       pos_type & pos = top().pos();
+                       while (pos < lastp && !par.isInset(pos))
+                               ++pos;
+               }
                forwardPos();
+       }
+
+#if 0
+       while (!cmp.empty() && (!cmp.inTexted() || cmp.pos() != 0))
+               cmp.forwardPos();
+       BOOST_ASSERT(cmp == *this);
+#endif
 }