From 3a9e688b73e41a63da7328512c046ebb37b3d803 Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Sat, 2 Apr 2005 14:19:31 +0000 Subject: [PATCH] Fix math cursor positioning bug git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9770 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 4 ++++ src/mathed/math_data.C | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 5c1436b83a..6fe71f8764 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +2005-04-02 Martin Vermeer + + * math_data.C (x2pos): fix math cursor positioning bug + 2005-03-27 Georg Baum * math_amsarrayinset.[Ch] (validate): new, require amsmath diff --git a/src/mathed/math_data.C b/src/mathed/math_data.C index 913eeef60f..b26a119a08 100644 --- a/src/mathed/math_data.C +++ b/src/mathed/math_data.C @@ -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(); } -- 2.39.2