From 04076d27acff102a78e785841d05146f1135eed8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 14 Jan 2004 17:58:07 +0000 Subject: [PATCH] more math iterator adjustment git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8350 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formulabase.C | 6 ++++-- src/mathed/math_cursor.C | 3 ++- src/mathed/math_iterator.C | 10 +--------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 40b6a1ea61..eba3876d0c 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -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; } diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 4cb27cefed..7dcaedbe19 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -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); diff --git a/src/mathed/math_iterator.C b/src/mathed/math_iterator.C index e06157c864..2f949af5fd 100644 --- a/src/mathed/math_iterator.C +++ b/src/mathed/math_iterator.C @@ -17,13 +17,6 @@ #include -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; } -- 2.39.2