]> git.lyx.org Git - features.git/commitdiff
When selecting math with the mouse, selection happens in the middle (#9748)
authorGuillaume Munch <gm@lyx.org>
Sat, 18 Feb 2017 19:41:41 +0000 (20:41 +0100)
committerGuillaume Munch <gm@lyx.org>
Sat, 18 Feb 2017 22:03:54 +0000 (23:03 +0100)
src/mathed/InsetMathNest.cpp

index ceec393ee6aa220b194f9c72a5b978e90225555e..ee0edd964fdd1bd39cd6ec85f4634c9128030dba 100644 (file)
@@ -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