commit a24033ff0e49316ba90919f024c561914d55ad47 Author: Enrico Forestieri <for...@lyx.org> Date: Mon Sep 12 07:55:38 2016 +0200
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. --- src/Cursor.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index b3c1edd..64d7ad3 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -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);