+ // move on one position if possible
+ if (pos() < lastpos()) {
+ //lyxerr << "... next pos" << endl;
+ ++pos();
+ return;
+ }
+
+ // otherwise move on one paragraph if possible
+ if (pit() < lastpit()) {
+ //lyxerr << "... next par" << endl;
+ ++pit();
+ pos() = 0;
+ return;
+ }
+
+ // otherwise try to move on one cell if possible
+ if (idx() < lastidx()) {
+ //lyxerr << "... next idx" << endl;
+ ++idx();
+ pit() = 0;
+ pos() = 0;
+ return;
+ }
+ BOOST_ASSERT(false);