From 5cdbaf51ee73e23b9c0dfd6e8a9aa5fea1d798de Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Sat, 10 Sep 2016 02:39:57 +0200 Subject: [PATCH] Avoid duplicating mode changing commands --- src/Cursor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 6f1a1949d1..4e63734155 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -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);