]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_iterator.C
fix typo that put too many include paths for most people
[lyx.git] / src / mathed / math_iterator.C
index 91e022bae4e232e1d4fa666b68249e0c23ddc331..628ead5cab346f3afc8ceaf414ea822801c93676 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <config.h>
 
 #include "math_iterator.h"
@@ -104,17 +103,19 @@ void MathIterator::operator++()
                return;
        }
 
-       // otherwise move on one cell if possible
-       if (top.idx_ + 1 < top.par_->nargs()) {
+       // otherwise try to move on one cell if possible
+       while (top.idx_ + 1 < top.par_->nargs()) {
                // idx() == nargs() is _not_ valid!
                ++top.idx_;
-               top.pos_ = 0;
-               return;
+               if (top.par_->validCell(top.idx_)) {
+                       top.pos_ = 0;
+                       return;
+               }
        }
 
        // otherwise leave array, move on one position
        // this might yield pos() == size(), but that's a ok.
-       pop(); 
+       pop();
        // it certainly invalidates top
        ++position().pos_;
 }
@@ -133,7 +134,7 @@ bool operator==(MathIterator const & it, MathIterator const & jt)
        //lyxerr << "==: " << it.cursor().size() << " " << jt.cursor().size() << endl;
        if (it.cursor().size() != jt.cursor().size())
                return false;
-       return it.cursor() == jt.cursor();      
+       return it.cursor() == jt.cursor();
 }
 
 
@@ -142,7 +143,7 @@ bool operator!=(MathIterator const & it, MathIterator const & jt)
        //lyxerr << "!=: " << it.cursor().size() << " " << jt.cursor().size() << endl;
        if (it.cursor().size() != jt.cursor().size())
                return true;
-       return it.cursor() != jt.cursor();      
+       return it.cursor() != jt.cursor();
 }