commit faeb1997932dd60909ebe7c7883a5c8fbfe81e8c
Author: Guillaume Munch <g...@lyx.org>
Date:   Sat Feb 18 20:41:41 2017 +0100

    When selecting math with the mouse, selection happens in the middle (#9748)
---
 src/mathed/InsetMathNest.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index ceec393..ee0edd9 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -1625,6 +1625,16 @@ void InsetMathNest::lfunMouseMotion(Cursor & cur, 
FuncRequest & cmd)
                return;
        }
 
+       // set cursor after the inset if x is nearer to that position (bug 9748)
+       if (Inset const * inset = cur.nextInset()) {
+               CoordCache::Insets const & insetCache =
+                       cur.bv().coordCache().getInsets();
+               int const wid = insetCache.dim(inset).wid;
+               Point p = insetCache.xy(inset);
+               if (cmd.x() > p.x_ + (wid + 1) / 2)
+                       cur.posForward();
+       }
+
        CursorSlice old = bvcur.top();
 
        // We continue with our existing selection or start a new one, so don't

Reply via email to