On Wed, May 20, 2009 at 04:52:04PM +0200, for...@lyx.org wrote:

> Author: forenr
> Date: Wed May 20 16:52:03 2009
> New Revision: 29746
> URL: http://www.lyx.org/trac/changeset/29746
> 
> Log:
> Fix bug #1435. Now Ctrl-m enters math mode when in text-in-math mode,
> instead of producing nested text boxes.

Ok for branch? This is pretty safe and only allows entering an EnsureMath
inset by Ctrl-m instead of typing \ensuremath.

> Modified:
>    lyx-devel/trunk/src/mathed/InsetMathNest.cpp
> 
> Modified: lyx-devel/trunk/src/mathed/InsetMathNest.cpp
> ==============================================================================
> --- lyx-devel/trunk/src/mathed/InsetMathNest.cpp      Wed May 20 01:34:12 
> 2009        (r29745)
> +++ lyx-devel/trunk/src/mathed/InsetMathNest.cpp      Wed May 20 16:52:03 
> 2009        (r29746)
> @@ -20,6 +20,7 @@
>  #include "InsetMathColor.h"
>  #include "InsetMathComment.h"
>  #include "InsetMathDelim.h"
> +#include "InsetMathEnsureMath.h"
>  #include "InsetMathHull.h"
>  #include "InsetMathRef.h"
>  #include "InsetMathScript.h"
> @@ -954,7 +955,10 @@
>               docstring const save_selection = grabAndEraseSelection(cur);
>               selClearOrDel(cur);
>               //cur.plainInsert(MathAtom(new InsetMathMBox(cur.bv())));
> -             cur.plainInsert(MathAtom(new InsetMathBox(from_ascii("mbox"))));
> +             if (currentMode() == Inset::TEXT_MODE)
> +                     cur.plainInsert(MathAtom(new InsetMathEnsureMath));
> +             else
> +                     cur.plainInsert(MathAtom(new 
> InsetMathBox(from_ascii("mbox"))));
>               cur.posBackward();
>               cur.pushBackward(*cur.nextInset());
>               cur.niceInsert(save_selection);
> 

-- 
Enrico

Reply via email to