Avoid duplicating mode changing commands

This commit is contained in:
Enrico Forestieri 2016-09-10 02:39:57 +02:00
parent 324651899e
commit 5cdbaf51ee

View File

@ -1450,13 +1450,15 @@ bool Cursor::macroModeClose()
atom.nucleus()->cell(0).append(selection);
if (in->currentMode() == Inset::TEXT_MODE
&& atom.nucleus()->currentMode() == Inset::MATH_MODE) {
&& atom.nucleus()->currentMode() == Inset::MATH_MODE
&& name != from_ascii("ensuremath")) {
MathAtom at(new InsetMathEnsureMath(buffer()));
at.nucleus()->cell(0).push_back(atom);
niceInsert(at);
posForward();
} else if (in->currentMode() == Inset::MATH_MODE
&& atom.nucleus()->currentMode() == Inset::TEXT_MODE) {
&& atom.nucleus()->currentMode() == Inset::TEXT_MODE
&& name != from_ascii("text")) {
MathAtom at = createInsetMath("text", buffer());
at.nucleus()->cell(0).push_back(atom);
niceInsert(at);