This patch (that should have been applied long ago) speeds up
forwardInset like I did to forwardPar earlier. This will benefit to
all code uses this in big documents. This will go tomorrow in branch
and trunk if nobody complains.
JMarc
Index: src/dociterator.C
===================================================================
--- src/dociterator.C (revision 15765)
+++ src/dociterator.C (working copy)
@@ -410,10 +410,6 @@ void DocIterator::forwardPar()
{
forwardPos();
-#if 0
- DocIterator cmp(*this);
-#endif
-
while (!empty() && (!inTexted() || pos() != 0)) {
if (inTexted()) {
pos_type const lastp = lastpos();
@@ -424,12 +420,6 @@ void DocIterator::forwardPar()
}
forwardPos();
}
-
-#if 0
- while (!cmp.empty() && (!cmp.inTexted() || cmp.pos() != 0))
- cmp.forwardPos();
- BOOST_ASSERT(cmp == *this);
-#endif
}
@@ -444,8 +434,19 @@ void DocIterator::forwardChar()
void DocIterator::forwardInset()
{
forwardPos();
- while (!empty() && (pos() == lastpos() || nextInset() == 0))
+
+ while (!empty() && !nextInset()) {
+ if (inTexted()) {
+ pos_type const lastp = lastpos();
+ Paragraph const & par = paragraph();
+ pos_type & pos = top().pos();
+ while (pos < lastp && !par.isInset(pos))
+ ++pos;
+ if (pos < lastp)
+ break;
+ }
forwardPos();
+ }
}