}
-void MathMacroTemplate::updateToContext(MacroContext const & mc) const
+void MathMacroTemplate::updateToContext(MacroContext const & mc)
{
redefinition_ = mc.get(name()) != 0;
}
// valid macro?
MacroData const * macro = 0;
- if (validName()) {
+ if (validName())
macro = mi.macrocontext.get(name());
- // updateToContext() - avoids another lookup
- redefinition_ = macro != 0;
- }
-
// update look?
int argsInDef = maxArgumentInDefinition();
if (lookOutdated_ || argsInDef != argsInLook_) {
bool MathMacroTemplate::notifyCursorLeaves(Cursor const & old, Cursor & cur)
{
+ unsigned int const nargs_before = nargs();
commitEditChanges(cur, old);
updateLook();
cur.screenUpdateFlags(Update::Force);
- return InsetMathNest::notifyCursorLeaves(old, cur);
+ // If we have removed a cell, we might have invalidated the cursor
+ return InsetMathNest::notifyCursorLeaves(old, cur)
+ || nargs() < nargs_before;
}