#include "FuncRequest.h"
#include "FuncStatus.h"
#include "Lexer.h"
-#include "LyXRC.h"
#include "frontends/Painter.h"
}
-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;
}
MathMacro * macro = insetMath->asMacro();
if (macro && macro->name() == name && macro->folded()) {
fix(macro);
- if (RenderPreview::status() == LyXRC::PREVIEW_ON)
+ if (RenderPreview::previewMath())
preview_reload_needed = true;
}
}
for (; sit != end; ++sit) {
InsetMathHull * inset_hull =
sit->nextInset()->asInsetMath()->asHullInset();
- LBUFERR(inset_hull, _("Error loading macro previews."));
+ LBUFERR(inset_hull);
inset_hull->reloadPreview(*sit);
}
cur.screenUpdateFlags(Update::Force);