+ DocIterator tmpcur = cur;
+ // Leave math first
+ while (tmpcur.inMathed())
+ tmpcur.pop_back();
+ Change change_next_pos
+ = tmpcur.paragraph().lookupChange(tmpcur.pos());
+ if (change_next_pos.changed() && cur.inMathed()) {
+ cur = tmpcur;
+ search_both_sides = true;
+ } else if (tmpcur.pos() > 0 && tmpcur.inTexted()) {