On Sat, Jan 21, 2006 at 02:13:47PM +0200, Martin Vermeer wrote:
> On Fri, Jan 20, 2006 at 10:06:15PM +0200, Martin Vermeer wrote:
> > On Fri, Jan 20, 2006 at 04:04:36PM +0100, Jean-Marc Lasgouttes wrote:
> > > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
> 
> ...
>  
> BTW2, we still have the cursor movement bug that the cursor doesn't
> move straight into an equation, but moves first to the left side of it,
> and only then in (to the correct x position too) on the next cursor
> up/down. This appears to be connected with checkInsetHit and editXY,
> which ought to be called recursively but don't seem to be. Someone
> should look into that.


A patch for this is attached. An unbelievable story really... when
doing cursor up/down, the new y co-ordinate is just _one pixel_ into the
next/previous row! Therefore the test for being inside a math inset will
only trigger for the hull inset, not for anything inside there like an
array inset...

The patch makes cursor movement a little more generous ;-)

Works well on the various math insets in the user Guide.

- 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     21 Jan 2006 22:50:10 -0000
@@ -1031,7 +1047,8 @@ 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:
+               editXY(cur, x, y - par.rows()[row].height() - 12);
                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].height());
                cur.clearSelection();
 
                // This happens when you move out of an inset.

Attachment: pgpWRgu5lNgLw.pgp
Description: PGP signature

Reply via email to