X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCursor.cpp;h=ad46e8c50567e61af367f7b1c90e26133393086d;hb=313d9fa4d056ed213607500076c1bd391a563b6d;hp=1d492d2c4b3c4129790cda0d96a07c77a3d61322;hpb=c2facb8c565610d6a702c39b2f95572551f624be;p=lyx.git diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 1d492d2c4b..ad46e8c505 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1712,8 +1712,11 @@ void Cursor::handleNest(MathAtom const & a) { idx_type const idx = a.nucleus()->asNestInset()->firstIdx(); //lyxerr << "Cursor::handleNest: " << idx << endl; + InsetMath const * im = selectionBegin().inset().asInsetMath(); + Parse::flags const f = im && im->currentMode() != InsetMath::MATH_MODE + ? Parse::TEXTMODE : Parse::NORMAL; MathAtom t = a; - asArray(cap::grabAndEraseSelection(*this), t.nucleus()->cell(idx)); + asArray(cap::grabAndEraseSelection(*this), t.nucleus()->cell(idx), f); insert(t); editInsertedInset(); } @@ -2038,7 +2041,7 @@ bool Cursor::mathForward(bool word) while (pos() < lastpos() && mc == nextMath().mathClass()); } else if (openable(nextAtom())) { InsetMathScript const * n = nextMath().asScriptInset(); - bool to_brace_deco = n + bool to_brace_deco = n && !n->nuc().empty() && n->nuc().back()->lyxCode() == MATH_DECORATION_CODE && n->nuc().back()->mathClass() == MC_OP; // single step: try to enter the next inset @@ -2092,7 +2095,7 @@ bool Cursor::mathBackward(bool word) } } else if (openable(prevAtom())) { InsetMathScript const * p = prevMath().asScriptInset(); - bool to_brace_deco = p + bool to_brace_deco = p && !p->nuc().empty() && p->nuc().back()->lyxCode() == MATH_DECORATION_CODE && p->nuc().back()->mathClass() == MC_OP; // single step: try to enter the preceding inset