X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathNest.cpp;h=70ef1858c4cdec570446fc0ba842055e0a6e231f;hb=a11780b59fcb6cdd16b15f9fa4de45d7ddfd1b2a;hp=54d96d919097ca286f47373b77d4f632cee484cc;hpb=e26a60edef3eae39c2e8379f395febedc5ba7efa;p=features.git diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 54d96d9190..70ef1858c4 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -548,6 +548,15 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) topaste = cap::selection(n, make_pair(buffer().params().documentClassPtr(), buffer().params().authors())); } + InsetMath const * im = cur.inset().asInsetMath(); + InsetMathMacro const * macro = im ? im->asMacro() : nullptr; + // do not allow pasting a backslash in the name of a macro + if (macro + && macro->displayMode() == InsetMathMacro::DISPLAY_UNFOLDED + && support::contains(topaste, char_type('\\'))) { + LYXERR0("Removing backslash from pasted string"); + topaste = subst(topaste, from_ascii("\\"), docstring()); + } cur.niceInsert(topaste, parseflg, false); cur.clearSelection(); // bug 393 cur.forceBufferUpdate();