Fix bug #6939 (Using math-insert to input math macros overwrites math expressions)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36216 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2010-11-09 00:03:32 +00:00
parent ffc562bbe1
commit 1f6370dfd7

View File

@ -1353,6 +1353,15 @@ void Cursor::niceInsert(MathAtom const & t)
MathData ar(buffer());
asArray(safe, ar);
insert(ar);
} else if (t->asMacro() && !safe.empty()) {
MathData ar(buffer());
asArray(safe, ar);
docstring const name = t->asMacro()->name();
MacroData const * data = buffer()->getMacro(name);
if (data && data->numargs() - data->optionals() > 0) {
plainInsert(MathAtom(new InsetMathBrace(ar)));
posBackward();
}
}
}