more math iterator adjustment

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8350 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2004-01-14 17:58:07 +00:00
parent 95ced6f509
commit 04076d27ac
3 changed files with 7 additions and 12 deletions

View 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;
}

View 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);

View File

@ -17,13 +17,6 @@
#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;
}