]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathScript.cpp
Fix regression of 18779013 for \smash
[lyx.git] / src / mathed / InsetMathScript.cpp
index ba2be2f729adddff8a17a16e66fabd886de89c64..7e501bc5a75884e9e984010276774b8d8b3d989f 100644 (file)
@@ -16,7 +16,6 @@
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "InsetMathBrace.h"
-#include "InsetMathFont.h"
 #include "InsetMathScript.h"
 #include "InsetMathSymbol.h"
 #include "LaTeXFeatures.h"
 #include "MathSupport.h"
 
 #include "support/debug.h"
+#include "support/gettext.h"
 
 #include "support/lassert.h"
 
-#include <ostream>
 
 using namespace std;
 
@@ -48,7 +47,7 @@ InsetMathScript::InsetMathScript(Buffer * buf, bool up)
 InsetMathScript::InsetMathScript(Buffer * buf, MathAtom const & at, bool up)
        : InsetMathNest(buf, 2), cell_1_is_up_(up), limits_(0)
 {
-       LASSERT(nargs() >= 1, /**/);
+       LATTEST(nargs() >= 1);
        cell(0).push_back(at);
 }
 
@@ -91,7 +90,7 @@ MathData const & InsetMathScript::down() const
 {
        if (nargs() == 3)
                return cell(2);
-       LASSERT(nargs() > 1, /**/);
+       LBUFERR(nargs() > 1);
        return cell(1);
 }
 
@@ -100,21 +99,21 @@ MathData & InsetMathScript::down()
 {
        if (nargs() == 3)
                return cell(2);
-       LASSERT(nargs() > 1, /**/);
+       LBUFERR(nargs() > 1);
        return cell(1);
 }
 
 
 MathData const & InsetMathScript::up() const
 {
-       LASSERT(nargs() > 1, /**/);
+       LBUFERR(nargs() > 1);
        return cell(1);
 }
 
 
 MathData & InsetMathScript::up()
 {
-       LASSERT(nargs() > 1, /**/);
+       LBUFERR(nargs() > 1);
        return cell(1);
 }
 
@@ -148,31 +147,6 @@ MathData & InsetMathScript::nuc()
 }
 
 
-namespace {
-
-bool isAlphaSymbol(MathAtom const & at)
-{
-       if (at->asCharInset() ||
-                       (at->asSymbolInset() &&
-                        at->asSymbolInset()->isOrdAlpha()))
-               return true;
-
-       if (at->asFontInset()) {
-               MathData const & ar = at->asFontInset()->cell(0);
-               for (size_t i = 0; i < ar.size(); ++i) {
-                       if (!(ar[i]->asCharInset() ||
-                                       (ar[i]->asSymbolInset() &&
-                                        ar[i]->asSymbolInset()->isOrdAlpha())))
-                               return false;
-               }
-               return true;
-       }
-       return false;
-}
-
-} // namespace anon
-
-
 int InsetMathScript::dy01(BufferView const & bv, int asc, int des, int what) const
 {
        int dasc = 0;
@@ -248,7 +222,7 @@ int InsetMathScript::dy1(BufferView const & bv) const
 
 int InsetMathScript::dx0(BufferView const & bv) const
 {
-       LASSERT(hasDown(), /**/);
+       LASSERT(hasDown(), return 0);
        Dimension const dim = dimension(bv);
        return hasLimits() ? (dim.wid - down().dimension(bv).width()) / 2 : nwid(bv);
 }
@@ -256,7 +230,7 @@ int InsetMathScript::dx0(BufferView const & bv) const
 
 int InsetMathScript::dx1(BufferView const & bv) const
 {
-       LASSERT(hasUp(), /**/);
+       LASSERT(hasUp(), return 0);
        Dimension const dim = dimension(bv);
        return hasLimits() ? (dim.wid - up().dimension(bv).width()) / 2 : nwid(bv) + nker(&bv);
 }
@@ -465,9 +439,7 @@ Inset::idx_type InsetMathScript::idxOfScript(bool up) const
                return (cell_1_is_up_ == up) ? 1 : 0;
        if (nargs() == 3)
                return up ? 1 : 2;
-       LASSERT(false, /**/);
-       // Silence compiler
-       return 0;
+       LASSERT(false, return 0);
 }