Attached two cursor movement patches (were posted already earlier). One of them makes motion within a math inset sensible again (by converting relative to absolute coordinates; fixes a bug), the other makes going up/down into a math inset more reasonable esp. for display style insets.
Please give this some testing. They are very straightforward. - Martin
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.638
diff -u -p -r1.638 text2.C
--- text2.C 23 Jan 2006 10:25:41 -0000 1.638
+++ text2.C 27 Jan 2006 07:14:42 -0000
@@ -1045,7 +1054,9 @@ bool LyXText::cursorUp(LCursor & cur)
if (!cur.selection()) {
int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
LCursor old = cur;
- editXY(cur, x, y - par.rows()[row].ascent() - 1);
+ // Go to middle of previous row. 16 found to work OK;
+ // 12 = top/bottom margin of display math
+ editXY(cur, x, y - par.rows()[row].ascent() - 16);
cur.clearSelection();
// This happens when you move out of an inset.
@@ -1091,7 +1102,8 @@ bool LyXText::cursorDown(LCursor & cur)
if (!cur.selection()) {
int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
LCursor old = cur;
- editXY(cur, x, y + par.rows()[row].descent() + 1);
+ // To middle of next row
+ editXY(cur, x, y + par.rows()[row].descent() + 16);
cur.clearSelection();
// This happens when you move out of an inset.
Index: cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
retrieving revision 1.142
diff -u -p -r1.142 cursor.C
--- cursor.C 19 Jan 2006 15:49:20 -0000 1.142
+++ cursor.C 27 Jan 2006 07:24:11 -0000
@@ -97,7 +97,12 @@ namespace {
for (size_t i = 0; ; ++i) {
int xo;
int yo;
- it.inset().cursorPos(it.top(), c.boundary() && ((i+1)
== it.depth()), xo, yo);
+ InsetBase const * inset = &it.inset();
+ Point o = theCoords.getInsets().xy(inset);
+ inset->cursorPos(it.top(), c.boundary(), xo, yo);
+ // Convert to absolute
+ xo += o.x_;
+ yo += o.y_;
double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
// '<=' in order to take the last possible position
// this is important for clicking behind \sum in e.g.
'\sum_i a'
pgpef0sKMIvU0.pgp
Description: PGP signature
