mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-01 13:40:39 +00:00
Do not allow pasting backslashes in macro names
Backslashes are not allowed in macro names and LyX enforces this by not allowing entering them by keyboard. However, it was possible to paste them and this may cause crashes (see bug #12596).
This commit is contained in:
parent
e26a60edef
commit
a11780b59f
@ -548,6 +548,15 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
topaste = cap::selection(n, make_pair(buffer().params().documentClassPtr(),
|
topaste = cap::selection(n, make_pair(buffer().params().documentClassPtr(),
|
||||||
buffer().params().authors()));
|
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.niceInsert(topaste, parseflg, false);
|
||||||
cur.clearSelection(); // bug 393
|
cur.clearSelection(); // bug 393
|
||||||
cur.forceBufferUpdate();
|
cur.forceBufferUpdate();
|
||||||
|
Loading…
Reference in New Issue
Block a user