From 1f6370dfd79529ddb180bed3720c8dff895e614b Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Tue, 9 Nov 2010 00:03:32 +0000 Subject: [PATCH] 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 --- src/Cursor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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(); + } } } -- 2.39.2