Ensure consistency

On export, a macro defined in ERT (or not defined at all) is left
in the same environment it is entered. So, don't explicitly insert
it in an ensuremath environment when it is entered in a textmode one.
This commit is contained in:
Enrico Forestieri 2016-09-12 07:55:38 +02:00
parent 615c733844
commit a24033ff0e

View File

@ -1449,9 +1449,11 @@ bool Cursor::macroModeClose()
else if (atom.nucleus()->nargs() > 0)
atom.nucleus()->cell(0).append(selection);
bool ert_macro = atomAsMacro && !atomAsMacro->macro();
if (in && in->currentMode() == Inset::TEXT_MODE
&& atom.nucleus()->currentMode() == Inset::MATH_MODE
&& name != from_ascii("ensuremath")) {
&& name != from_ascii("ensuremath") && !ert_macro) {
MathAtom at(new InsetMathEnsureMath(buffer()));
at.nucleus()->cell(0).push_back(atom);
niceInsert(at);