]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
(finishing patch -- question was restored, but there were still problems)
[lyx.git] / 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();
+               }
        }
 }