Fix math cursor positioning bug

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9770 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2005-04-02 14:19:31 +00:00
parent 5307494394
commit 3a9e688b73
2 changed files with 12 additions and 0 deletions

View 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> 2005-03-27 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* math_amsarrayinset.[Ch] (validate): new, require amsmath * math_amsarrayinset.[Ch] (validate): new, require amsmath

View File

@ -380,8 +380,16 @@ MathArray::size_type MathArray::x2pos(int targetx, int glue) const
currx += glue; currx += glue;
currx += (*it)->width(); currx += (*it)->width();
} }
if (abs(lastx - targetx) < abs(currx - targetx) && it != begin()) if (abs(lastx - targetx) < abs(currx - targetx) && it != begin())
--it; --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(); return it - begin();
} }