]> git.lyx.org Git - lyx.git/blobdiff - src/DocIterator.cpp
39 to go
[lyx.git] / src / DocIterator.cpp
index 3ab86af6449eefa3ef8dcb09471092a643af82f5..07e0d6f5e0d012a7e24dfeb18400db2c3cae2789 100644 (file)
@@ -78,7 +78,7 @@ Inset * DocIterator::prevInset() const
        BOOST_ASSERT(!empty());
        if (pos() == 0)
                return 0;
-       if (inMathed())
+       if (inMathed()) {
                if (cell().empty())
                        // FIXME: this should not happen but it does.
                        // See bug 3189
@@ -86,6 +86,7 @@ Inset * DocIterator::prevInset() const
                        return 0;
                else
                        return prevAtom().nucleus();
+       }
        return paragraph().isInset(pos() - 1) ? paragraph().getInset(pos() - 1) : 0;
 }
 
@@ -136,18 +137,26 @@ Paragraph & DocIterator::paragraph() const
 
 
 Paragraph & DocIterator::innerParagraph() const
+{
+       BOOST_ASSERT(!empty());
+       return innerTextSlice().paragraph();
+}
+
+
+CursorSlice const & DocIterator::innerTextSlice() const
 {
        BOOST_ASSERT(!empty());
        // go up until first non-0 text is hit
        // (innermost text is 0 in mathed)
        for (int i = depth() - 1; i >= 0; --i)
                if (slices_[i].text())
-                       return slices_[i].paragraph();
+                       return slices_[i];
 
        // This case is in principe not possible. We _must_
-       // be inside a Paragraph.
+       // be inside a Text.
        BOOST_ASSERT(false);
-       return paragraph();
+       static CursorSlice dummy;
+       return dummy;
 }
 
 
@@ -305,18 +314,6 @@ void DocIterator::forwardPar()
 }
 
 
-void DocIterator::forwardIdx()
-{
-       CursorSlice & tip = top();
-
-       //prevent endless loops
-       BOOST_ASSERT(tip.idx() < tip.nargs());
-       ++tip.idx();
-       tip.pit() = 0;
-       tip.pos() = 0;
-}
-
-
 void DocIterator::forwardChar()
 {
        forwardPos();