On Fri, Apr 01, 2005 at 05:42:30PM +0300, Martin Vermeer wrote: > > Attached is a patch that fixes this cursor positioning problem for math > insets-within-insets. I don't like it very much but it works, and it is > based on an understanding of the bug's mechanism, which is always > comforting. (Would it be easier just to sacrifice the "hack" and do it > properly? How much work would that be?) > > Please give it a try. > > After this fix, I noticed another bug: place the cursor with the mouse > in a rightmost cell in an array, and then use the right arrow key to > exit the array inset (going to the surrounding hull inset) --> crash. > Reverting my patch didn't help, so this bug has been there hiding all > the time...
Attached the alternative patch, which fixes both this new bug and the original cursor positioning bug. (I mean, why handle the effect of the cursor landing in the wrong place, when you can make it land in the right place?). Hmmm... I like small patches. As this fix is obviously right, it will go in later this weekend if nobody shouts (I assume active developers are aware of [EMAIL PROTECTED], right?) - Martin > _______________________________________________ > Devel mailing list > [EMAIL PROTECTED] I sure wish Mate would wake up... it's weekend!
Index: math_data.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_data.C,v retrieving revision 1.61 diff -u -r1.61 math_data.C --- math_data.C 8 Feb 2005 13:18:05 -0000 1.61 +++ math_data.C 2 Apr 2005 07:50:19 -0000 @@ -380,8 +380,16 @@ currx += glue; currx += (*it)->width(); } + if (abs(lastx - targetx) < abs(currx - targetx) && it != begin()) --it; + // The below code guarantees that in this slice, the cursor will + // never be on the right edge of an inset after a mouse click. + if (it != begin()) + --it; + if (it < end() && (*it)->getChar()) + ++it; + return it - begin(); }
pgptbfgnri0eI.pgp
Description: PGP signature