- CursorSlice & tip = top();
- pos_type const lastp = lastpos();
-
- // move on one position if possible
- if (tip.pos() < lastp) {
- //lyxerr << "... next pos" << endl;
- ++tip.pos();
- return;
- }
- //lyxerr << "... no next pos" << endl;
-
- // otherwise move on one paragraph if possible
- if (tip.pit() < lastpit()) {
- //lyxerr << "... next par" << endl;
- ++tip.pit();
- tip.pos() = 0;
- return;
- }
- //lyxerr << "... no next pit" << endl;
-
- // otherwise try to move on one cell if possible
- if (tip.idx() < lastidx()) {
- //lyxerr << "... next idx" << endl;
- ++tip.idx();
- tip.pit() = 0;
- tip.pos() = 0;
+ Inset * const nextinset = nextInset();
+ // FIXME: the check for asInsetMath() shouldn't be necessary
+ // but math insets do not return a sensible editable() state yet.
+ if (nextinset && !nextinset->asInsetMath()
+ && nextinset->editable() != Inset::HIGHLY_EDITABLE) {
+ ++top().pos();