]> git.lyx.org Git - features.git/commitdiff
more math iterator adjustment
authorAndré Pönitz <poenitz@gmx.net>
Wed, 14 Jan 2004 17:58:07 +0000 (17:58 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 14 Jan 2004 17:58:07 +0000 (17:58 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8350 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formulabase.C
src/mathed/math_cursor.C
src/mathed/math_iterator.C

index 40b6a1ea612578d9f23ace47e319ffa4c57a5c9a..eba3876d0c218b8f602a4ef20121bbfc2d901a06 100644 (file)
@@ -847,13 +847,15 @@ bool InsetFormulaBase::searchForward(BufferView * bv, string const & str,
        //lyxerr << "searching '" << str << "' in " << this << ar << endl;
 
        for (MathIterator it = current; it != iend(par().nucleus()); ++it) {
-               if (it.cell().matchpart(ar, it.back().pos_)) {
+               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.back().pos_ += ar.size();
+                       top.pos_ += ar.size();
                        bv->update();
                        return true;
                }
index 4cb27cefed36d3ded615d172ecdaed47bf074f65..7dcaedbe19bc940b0e98c8e23993b8b078468b31 100644 (file)
@@ -1068,7 +1068,8 @@ void MathCursor::bruteFind2(int x, int y)
        MathIterator it = Cursor_;
        it.back().setPos(0);
        MathIterator et = Cursor_;
-       et.back().setPos(it.cell().size());
+       int n = et.back().asMathInset()->cell(et.back().idx_).size();
+       et.back().setPos(n);
        for (int i = 0; ; ++i) {
                int xo, yo;
                it.back().getPos(xo, yo);
index e06157c864bfca74ad0c42029a66347dac85d1e8..2f949af5fda80cb362ba445df61446cbeda2ec30 100644 (file)
 #include <boost/assert.hpp>
 
 
-MathArray const & MathIterator::cell() const
-{
-       CursorSlice const & top = back();
-       return top.asMathInset()->cell(top.idx_);
-}
-
-
 void MathIterator::operator++()
 {
        CursorSlice & top = back();
@@ -88,9 +81,8 @@ MathIterator iend(MathInset * p)
 {
        MathIterator it;
        it.push_back(CursorSlice(p));
-       return it;
        CursorSlice & top = it.back();
        top.idx_ = top.asMathInset()->nargs() - 1;
-       top.pos_ = it.cell().size();
+       top.pos_ = top.asMathInset()->cell(top.idx_).size();
        return it;
 }