#include "debug.h"
#include "lyxtext.h"
-#include "lyxrow.h"
#include "paragraph.h"
#include "mathed/MathData.h"
}
-Row & DocIterator::textRow()
-{
- BOOST_ASSERT(!paragraph().rows().empty());
- return paragraph().getRow(pos(), boundary_);
-}
-
-
-Row const & DocIterator::textRow() const
-{
- BOOST_ASSERT(!paragraph().rows().empty());
- return paragraph().getRow(pos(), boundary_);
-}
-
-
pit_type DocIterator::lastpit() const
{
return inMathed() ? 0 : text()->paragraphs().size() - 1;
}
-bool DocIterator::inMathed() const
-{
- return !empty() && inset().inMathed();
-}
-
-
-bool DocIterator::inTexted() const
-{
- return !empty() && !inset().inMathed();
-}
-
-
LyXText * DocIterator::innerText()
{
BOOST_ASSERT(!empty());
return;
}
+ InsetBase * const nextinset = nextInset();
// jump over collapsables if they are collapsed
// FIXME: the check for asInsetMath() shouldn't be necessary
// but math insets do not return a sensible editable() state yet.
- if (ignorecollapsed && nextInset() && (!nextInset()->asInsetMath()
- && nextInset()->editable() != InsetBase::HIGHLY_EDITABLE)) {
+ if (ignorecollapsed && nextinset && (!nextinset->asInsetMath()
+ && nextinset->editable() != InsetBase::HIGHLY_EDITABLE)) {
++top().pos();
return;
}
{
forwardPos();
-#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;
+ if (par.insetlist.empty())
+ pos = lastp;
+ else
+ 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
}
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();
+ }
}