]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathMacroTemplate.cpp
MSVC compile fix
[lyx.git] / src / mathed / MathMacroTemplate.cpp
index 8220aa68a636f8691ff616d6acf688659a94ba61..53cec03f740a9d84efad953d48192a6a910bc900 100644 (file)
@@ -465,7 +465,7 @@ docstring MathMacroTemplate::name() const
 }
 
 
-void MathMacroTemplate::updateToContext(MacroContext const & mc) const
+void MathMacroTemplate::updateToContext(MacroContext const & mc)
 {
        redefinition_ = mc.get(name()) != 0;
 }
@@ -551,13 +551,9 @@ void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
 
        // 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_) {
@@ -624,10 +620,13 @@ void MathMacroTemplate::edit(Cursor & cur, bool front, EntryDirection entry_from
 
 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;
 }
 
 
@@ -846,7 +845,7 @@ void fixMacroInstances(Cursor & cur, DocIterator const & inset_pos,
                for (; sit != end; ++sit) {
                        InsetMathHull * inset_hull =
                                sit->nextInset()->asInsetMath()->asHullInset();
-                       LASSERT(inset_hull, /**/);
+                       LBUFERR(inset_hull);
                        inset_hull->reloadPreview(*sit);
                }
                cur.screenUpdateFlags(Update::Force);
@@ -1252,8 +1251,8 @@ docstring MathMacroTemplate::xhtml(XHTMLStream &, OutputParams const &) const
        return docstring();
 }
 
-int MathMacroTemplate::plaintext(odocstream & os,
-                                OutputParams const &) const
+int MathMacroTemplate::plaintext(odocstringstream & os,
+                                OutputParams const &, size_t) const
 {
        static docstring const str = '[' + buffer().B_("math macro") + ']';