]> git.lyx.org Git - features.git/commitdiff
Fix bug #6939 (Using math-insert to input math macros overwrites math expressions)
authorEnrico Forestieri <forenr@lyx.org>
Tue, 9 Nov 2010 00:03:32 +0000 (00:03 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Tue, 9 Nov 2010 00:03:32 +0000 (00:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36216 a592a061-630c-0410-9148-cb99ea01b6c8

src/Cursor.cpp

index c2b6d7298934432adb7cf3fcc59346a2b08023a8..a76c68fae3893d4daa295de8330ee6b7c62f30c4 100644 (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();
+               }
        }
 }