somewhat better corser up/down handling

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2452 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-08-08 11:03:53 +00:00
parent 1cc8461767
commit e454df24f5
2 changed files with 38 additions and 32 deletions

View File

@ -518,7 +518,7 @@ bool MathCursor::up(bool sel)
selHandle(sel); selHandle(sel);
if (selection_) if (selection_)
return idxUp() || popLeft(); return goUp();
// check whether we could move into an inset on the right or on the left // check whether we could move into an inset on the right or on the left
MathInset * p = nextInset(); MathInset * p = nextInset();
@ -545,7 +545,7 @@ bool MathCursor::up(bool sel)
} }
} }
return idxUp() || popLeft(); return goUp();
} }
@ -556,7 +556,7 @@ bool MathCursor::down(bool sel)
selHandle(sel); selHandle(sel);
if (selection_) if (selection_)
return idxDown() || popLeft(); return goDown();
// check whether we could move into an inset on the right or on the left // check whether we could move into an inset on the right or on the left
MathInset * p = nextInset(); MathInset * p = nextInset();
@ -585,7 +585,7 @@ bool MathCursor::down(bool sel)
} }
} }
return idxDown() || popLeft(); return goDown();
} }
@ -1269,31 +1269,37 @@ void MathCursor::gotoX(int x)
} }
bool MathCursor::idxUp() bool MathCursor::goUp()
{ {
int x = par()->xo() + xpos(); int x0;
do { int y0;
if (par()->idxUp(idx(), pos())) { getPos(x0, y0);
gotoX(x - par()->xo()); std::vector<MathCursorPos> save = Cursor_;
y0 -= xarray().ascent();
for (int y = y0 - 4; y > outerPar()->yo() - outerPar()->ascent(); y -= 4) {
setPos(x0, y);
if (save != Cursor_ && xarray().yo() < y0)
return true; return true;
} }
} while (popLeft()); Cursor_ = save;
gotoX(x - par()->xo()); return false;
return true;
} }
bool MathCursor::idxDown() bool MathCursor::goDown()
{ {
int x = par()->xo() + xpos(); int x0;
do { int y0;
if (par()->idxDown(idx(), pos())) { getPos(x0, y0);
gotoX(x - par()->xo()); std::vector<MathCursorPos> save = Cursor_;
y0 += xarray().descent();
for (int y = y0 + 4; y < outerPar()->yo() + outerPar()->descent(); y += 4) {
setPos(x0, y);
if (save != Cursor_ && xarray().yo() > y0)
return true; return true;
} }
} while (popLeft()); Cursor_ = save;
gotoX(x - par()->xo()); return false;
return true;
} }

View File

@ -91,18 +91,18 @@ public:
void first(); void first();
/// Put the cursor in the last position /// Put the cursor in the last position
void last(); void last();
/// /// moves cursor position one cell to the left
bool posLeft(); bool posLeft();
/// /// moves cursor position one cell to the right
bool posRight(); bool posRight();
/// moves position one cell to the left /// moves cursor index one cell to the left
bool idxLeft(); bool idxLeft();
/// moves position one cell to the right /// moves cursor index one cell to the right
bool idxRight(); bool idxRight();
/// moves position one cell up /// moves position somehow up
bool idxUp(); bool goUp();
/// moves position one cell down /// moves position somehow down
bool idxDown(); bool goDown();
/// ///
void idxNext(); void idxNext();
/// ///