mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
fix two items from Konni's list of cursor up/down "issues"
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3810 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
19200304d7
commit
137aaf9cb2
@ -1,3 +1,8 @@
|
|||||||
|
|
||||||
|
2002-03-12 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
|
* math_cursor.C: fix some Up/Down "issues"
|
||||||
|
|
||||||
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
* most files: ws cleanup
|
* most files: ws cleanup
|
||||||
|
@ -1175,6 +1175,9 @@ MathCursorPos const & MathCursor::cursor() const
|
|||||||
|
|
||||||
bool MathCursor::goUpDown(bool up)
|
bool MathCursor::goUpDown(bool up)
|
||||||
{
|
{
|
||||||
|
// Be warned: The 'logic' implemented in this function is highly fragile.
|
||||||
|
// A distance of one pixel or a '<' vs '<=' _really_ matters.
|
||||||
|
// So fiddle around with it only if you know what you are doing!
|
||||||
int xlow, xhigh, ylow, yhigh;
|
int xlow, xhigh, ylow, yhigh;
|
||||||
|
|
||||||
int xo, yo;
|
int xo, yo;
|
||||||
@ -1219,8 +1222,10 @@ bool MathCursor::goUpDown(bool up)
|
|||||||
|
|
||||||
// try to find an inset that knows better then we
|
// try to find an inset that knows better then we
|
||||||
while (1) {
|
while (1) {
|
||||||
// we found a cell that thinks it has something "below" us.
|
///lyxerr << "updown: We are in " << *par() << " idx: " << idx() << '\n';
|
||||||
|
// ask inset first
|
||||||
if (par()->idxUpDown(idx(), up)) {
|
if (par()->idxUpDown(idx(), up)) {
|
||||||
|
// we found a cell that thinks it has something "below" us.
|
||||||
///lyxerr << "updown: found inset that handles UpDown\n";
|
///lyxerr << "updown: found inset that handles UpDown\n";
|
||||||
xarray().boundingBox(xlow, xhigh, ylow, yhigh);
|
xarray().boundingBox(xlow, xhigh, ylow, yhigh);
|
||||||
// project (xo,yo) onto proper box
|
// project (xo,yo) onto proper box
|
||||||
@ -1235,6 +1240,7 @@ bool MathCursor::goUpDown(bool up)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// leave inset
|
||||||
if (!popLeft()) {
|
if (!popLeft()) {
|
||||||
// no such inset found, just take something "above"
|
// no such inset found, just take something "above"
|
||||||
///lyxerr << "updown: handled by strange case\n";
|
///lyxerr << "updown: handled by strange case\n";
|
||||||
@ -1246,7 +1252,12 @@ bool MathCursor::goUpDown(bool up)
|
|||||||
up ? yo - 4 : formula()->yhigh()
|
up ? yo - 4 : formula()->yhigh()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
///lyxerr << "updown: looping\n";
|
|
||||||
|
// any improvement so far?
|
||||||
|
int xnew, ynew;
|
||||||
|
getPos(xnew, ynew);
|
||||||
|
if (up ? ynew < yo : ynew > yo)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1267,7 +1278,9 @@ bool MathCursor::bruteFind
|
|||||||
int yo = top.ypos();
|
int yo = top.ypos();
|
||||||
if (xlow <= xo && xo <= xhigh && ylow <= yo && yo <= yhigh) {
|
if (xlow <= xo && xo <= xhigh && ylow <= yo && yo <= yhigh) {
|
||||||
double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
|
double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
|
||||||
if (d < best_dist) {
|
// '<=' in order to take the last possible position
|
||||||
|
// this is important for clicking behind \sum in e.g. '\sum_i a'
|
||||||
|
if (d <= best_dist) {
|
||||||
best_dist = d;
|
best_dist = d;
|
||||||
best_cursor = it.cursor();
|
best_cursor = it.cursor();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user