]> git.lyx.org Git - lyx.git/blobdiff - src/dociterator.C
Fix bug 2029 (RtL space width)
[lyx.git] / src / dociterator.C
index b4fd5c2218892b23fc26617c782ea0f2451d8137..201e37b4b57c04cd43b6d8ee8aaf2b7d7d35d9f8 100644 (file)
@@ -22,6 +22,7 @@
 #include "mathed/math_inset.h"
 
 #include <boost/assert.hpp>
+#include <boost/current_function.hpp>
 
 using std::endl;
 
@@ -29,12 +30,12 @@ using std::endl;
 // We could be able to get rid of this if only every BufferView were
 // associated to a buffer on construction.
 DocIterator::DocIterator()
-       : inset_(0)
+       : boundary_(false), inset_(0)
 {}
 
 
 DocIterator::DocIterator(InsetBase & inset)
-       : inset_(&inset)
+       : boundary_(false), inset_(&inset)
 {}
 
 
@@ -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();
@@ -155,14 +156,14 @@ Paragraph const & DocIterator::paragraph() const
 Row & DocIterator::textRow()
 {
        BOOST_ASSERT(!paragraph().rows().empty());
-       return paragraph().getRow(pos());
+       return paragraph().getRow(pos(), boundary_);
 }
 
 
 Row const & DocIterator::textRow() const
 {
        BOOST_ASSERT(!paragraph().rows().empty());
-       return paragraph().getRow(pos());
+       return paragraph().getRow(pos(), boundary_);
 }
 
 
@@ -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
 }
 
 
@@ -520,3 +540,10 @@ std::ostream & operator<<(std::ostream & os, StableDocIterator const & dit)
                os << " " << dit.data_[i] << "\n";
        return os;
 }
+
+
+bool operator==(StableDocIterator const & dit1, StableDocIterator const & dit2)
+{
+       return dit1.data_ == dit2.data_;
+}
+