]> git.lyx.org Git - features.git/commitdiff
Fix math cursor positioning bug
authorMartin Vermeer <martin.vermeer@hut.fi>
Sat, 2 Apr 2005 14:19:31 +0000 (14:19 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Sat, 2 Apr 2005 14:19:31 +0000 (14:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9770 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_data.C

index 5c1436b83aee24bcfcac5b2c5f585c95bea95e40..6fe71f87649549d15d79d131837f5c25b8f1a8c8 100644 (file)
@@ -1,3 +1,7 @@
+2005-04-02  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * math_data.C (x2pos): fix math cursor positioning bug
+
 2005-03-27  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * math_amsarrayinset.[Ch] (validate): new, require amsmath
index 913eeef60ff57597b99455991e8807df6646916e..b26a119a08a38cb869977fd9a51452b9a11edd48 100644 (file)
@@ -380,8 +380,16 @@ MathArray::size_type MathArray::x2pos(int targetx, int glue) const
                        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();
 }