]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/formulabase.C
more IU
[lyx.git] / src / mathed / formulabase.C
index cdcf532a291e6bdc518a1fa339f4fb3541f50da7..3ff6ba7d170f9a37c827a6342223ded13313fdfd 100644 (file)
@@ -313,7 +313,7 @@ void InsetFormulaBase::edit(BufferView * bv, bool left)
        lyxerr << "Called FormulaBase::edit" << endl;
        releaseMathCursor(bv);
        mathcursor = new MathCursor(this, left);
-       bv->cursor().push(this);
+       bv->fullCursor().push(this);
        // if that is removed, we won't get the magenta box when entering an
        // inset for the first time
        bv->update();
@@ -327,7 +327,7 @@ void InsetFormulaBase::edit(BufferView * bv, int x, int y)
        mathcursor = new MathCursor(this, true);
        //metrics(bv);
        mathcursor->setPos(x + xo_, y + yo_);
-       bv->cursor().push(this);
+       bv->fullCursor().push(this);
        // if that is removed, we won't get the magenta box when entering an
        // inset for the first time
        bv->update();
@@ -830,7 +830,7 @@ bool InsetFormulaBase::searchForward(BufferView * bv, string const & str,
 #warning pretty ugly
 #endif
        static InsetFormulaBase * lastformula = 0;
-       static MathIterator current = MathIterator(ibegin(par().nucleus()));
+       static CursorBase current = CursorBase(ibegin(par().nucleus()));
        static MathArray ar;
        static string laststr;
 
@@ -842,18 +842,20 @@ bool InsetFormulaBase::searchForward(BufferView * bv, string const & str,
                ar.clear();
                mathed_parse_cell(ar, str);
        } else {
-               ++current;
+               increment(current);
        }
        //lyxerr << "searching '" << str << "' in " << this << ar << endl;
 
-       for (MathIterator it = current; it != iend(par().nucleus()); ++it) {
-               if (it.cell().matchpart(ar, it.back().pos_)) {
+       for (CursorBase it = current; it != iend(par().nucleus()); increment(it)) {
+               CursorSlice & top = it.back();
+               MathArray const & a = top.asMathInset()->cell(top.idx_);
+               if (a.matchpart(ar, top.pos_)) {
                        delete mathcursor;
                        mathcursor = new MathCursor(this, true);
                        //metrics(bv);
                        mathcursor->setSelection(it, ar.size());
                        current = it;
-                       it.jump(ar.size());
+                       top.pos_ += ar.size();
                        bv->update();
                        return true;
                }
@@ -901,7 +903,7 @@ void mathDispatchCreation(FuncRequest const & cmd, bool display)
        if (sel.empty()) {
                InsetFormula * f = new InsetFormula(bv);
                if (openNewInset(bv, f)) {
-                       bv->cursor().innerInset()->
+                       bv->fullCursor().innerInset()->
                                dispatch(FuncRequest(bv, LFUN_MATH_MUTATE, "simple"));
                        // don't do that also for LFUN_MATH_MODE unless you want end up with
                        // always changing to mathrm when opening an inlined inset
@@ -964,7 +966,7 @@ void mathDispatch(FuncRequest const & cmd)
                case LFUN_MATH_DELIM: {
                        InsetFormula * f = new InsetFormula(bv);
                        if (openNewInset(bv, f)) {
-                               UpdatableInset * inset = bv->cursor().innerInset();
+                               UpdatableInset * inset = bv->fullCursor().innerInset();
                                inset->dispatch(FuncRequest(bv, LFUN_MATH_MUTATE, "simple"));
                                inset->dispatch(cmd);
                        }