MathInset::idx_type idx = 0;
MathGridInset * p = mathcursor ? mathcursor->enclosingGrid(idx) : 0;
if (p) {
+ mathcursor->popToEnclosingGrid();
bv->lockedInsetStoreUndo(Undo::EDIT);
- char al = arg.size() ? arg[0] : 'c';
+ char align = arg.size() ? arg[0] : 'c';
switch (action) {
- case LFUN_MATH_HALIGN: p->halign(al, p->col(idx)); break;
- case LFUN_MATH_VALIGN: p->valign(al); break;
+ case LFUN_MATH_HALIGN: p->halign(align, p->col(idx)); break;
+ case LFUN_MATH_VALIGN: p->valign(align); break;
case LFUN_MATH_ROW_INSERT: p->addRow(p->row(idx)); break;
case LFUN_MATH_ROW_DELETE: p->delRow(p->row(idx)); break;
case LFUN_MATH_COLUMN_INSERT: p->addCol(p->col(idx)); break;
} else {
// create a macro if we see "\\newcommand" somewhere, and an ordinary
// formula otherwise
- if (sel.find("\\newcommand") == string::npos)
+ if (sel.find("\\newcommand") == string::npos &&
+ sel.find("\\def") == string::npos)
f = new InsetFormula(sel);
else {
string name;
if (arg.empty())
bv->owner()->getLyXFunc()->setErrorMessage(N_("Missing argument"));
else {
- string s(arg);
+ string s = arg;
string const s1 = token(s, ' ', 1);
int const na = s1.empty() ? 0 : lyx::atoi(s1);
openNewInset(bv, new InsetFormulaMacro(token(s, ' ', 0), na));