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);
if (selection_)
return idxUp() || popLeft();
return goUp();
// check whether we could move into an inset on the right or on the left
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);
if (selection_)
return idxDown() || popLeft();
return goDown();
// check whether we could move into an inset on the right or on the left
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();
do {
if (par()->idxUp(idx(), pos())) {
gotoX(x - par()->xo());
return true;
}
} while (popLeft());
gotoX(x - par()->xo());
return true;
int x0;
int y0;
getPos(x0, y0);
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;
}
Cursor_ = save;
return false;
}
bool MathCursor::idxDown()
bool MathCursor::goDown()
{
int x = par()->xo() + xpos();
do {
if (par()->idxDown(idx(), pos())) {
gotoX(x - par()->xo());
return true;
}
} while (popLeft());
gotoX(x - par()->xo());
return true;
int x0;
int y0;
getPos(x0, y0);
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;
}
Cursor_ = save;
return false;
}

View File

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