From: Enrico Forestieri Date: Tue, 9 Nov 2010 00:03:32 +0000 (+0000) Subject: Fix bug #6939 (Using math-insert to input math macros overwrites math expressions) X-Git-Tag: 2.0.0~1911 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1f6370dfd79529ddb180bed3720c8dff895e614b;p=features.git 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 --- diff --git a/src/Cursor.cpp b/src/Cursor.cpp index c2b6d72989..a76c68fae3 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -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(); + } } }