Author: forenr
Date: Tue Nov 9 01:03:32 2010
New Revision: 36216
URL: http://www.lyx.org/trac/changeset/36216
Log:
Fix bug #6939 (Using math-insert to input math macros overwrites math
expressions)
Modified:
lyx-devel/trunk/src/Cursor.cpp
Modified: lyx-devel/trunk/src/Cursor.cpp
==============================================================================
--- lyx-devel/trunk/src/Cursor.cpp Mon Nov 8 23:00:54 2010 (r36215)
+++ lyx-devel/trunk/src/Cursor.cpp Tue Nov 9 01:03:32 2010 (r36216)
@@ -1353,6 +1353,15 @@
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();
+ }
}
}