On Sun, 2006-01-22 at 20:43 +0100, Andre Poenitz wrote: > > The patch makes cursor movement a little more generous ;-) > > A comment stating this would be in order... > > Andre'
OK, see attached. Would somebody test this, please? Further remarks: 1) I don't think it is possible to get this completely right. A constant of 16 works well on the display math examples in the User Guide. Makeing it too big would lead to sometimes skipping over a row, which isn't acceptable either. 16 seems a good compromise. 2) There is still the older patch from last Saturday pending (rel<->abs cursor positioning in bruteFind2; Lars?) The current patch makes little sense without that one first :-) I attached that one again too. And yes, the definition of inset must be this way for it to compile... - Martin
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.637
diff -u -p -r1.637 text2.C
--- text2.C 4 Jan 2006 14:24:40 -0000 1.637
+++ text2.C 23 Jan 2006 08:21:02 -0000
@@ -1031,7 +1046,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.
@@ -1077,7 +1094,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 23 Jan 2006 08:27:38 -0000
@@ -97,7 +97,13 @@ 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(const_cast<InsetBase *>(&it.inset()));
+ InsetBase const * inset = &it.inset();
+ Point o = theCoords.getInsets().xy(inset);
+ inset->cursorPos(it.top(), c.boundary() /* && ((i+1) == it.depth())*/, 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'
signature.asc
Description: This is a digitally signed message part
