]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathHull.cpp
fix a crash when the inset containing the new word at cursor is deleted
[lyx.git] / src / mathed / InsetMathHull.cpp
index aa74b9c191e96dbd5af806039cfdadbae9cc706c..f06f7eba22204005958d69e93843dc6d1925238e 100644 (file)
@@ -779,9 +779,9 @@ void InsetMathHull::header_write(WriteStream & os) const
 
        case hullEquation:
                if (n)
-                       os << "\\begin{equation" << star(n) << "}\n";
+                       os << "\n\\begin{equation" << star(n) << "}\n";
                else
-                       os << "\\[\n";
+                       os << "\n\\[\n";
                break;
 
        case hullEqnArray:
@@ -789,17 +789,17 @@ void InsetMathHull::header_write(WriteStream & os) const
        case hullFlAlign:
        case hullGather:
        case hullMultline:
-               os << "\\begin{" << hullName(type_) << star(n) << "}\n";
+               os << "\n\\begin{" << hullName(type_) << star(n) << "}\n";
                break;
 
        case hullAlignAt:
        case hullXAlignAt:
-               os << "\\begin{" << hullName(type_) << star(n) << '}'
+               os << "\n\\begin{" << hullName(type_) << star(n) << '}'
                  << '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
                break;
 
        case hullXXAlignAt:
-               os << "\\begin{" << hullName(type_) << '}'
+               os << "\n\\begin{" << hullName(type_) << '}'
                  << '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
                break;
 
@@ -808,7 +808,7 @@ void InsetMathHull::header_write(WriteStream & os) const
                break;
 
        default:
-               os << "\\begin{unknown" << star(n) << "}\n";
+               os << "\n\\begin{unknown" << star(n) << "}\n";
                break;
        }
 }
@@ -1920,6 +1920,7 @@ int InsetMathHull::docbook(odocstream & os, OutputParams const & runparams) cons
        ++ms.tab(); ms.cr(); ms.os() << '<' << bname << '>';
 
        odocstringstream ls;
+       otexstream ols(ls);
        if (runparams.flavor == OutputParams::XML) {
                ms << MTag("alt role='tex' ");
                // Workaround for db2latex: db2latex always includes equations with
@@ -1936,7 +1937,7 @@ int InsetMathHull::docbook(odocstream & os, OutputParams const & runparams) cons
                ms << ETag("math");
        } else {
                ms << MTag("alt role='tex'");
-               res = latex(ls, runparams);
+               res = latex(ols, runparams);
                ms << from_utf8(subst(subst(to_utf8(ls.str()), "&", "&amp;"), "<", "&lt;"));
                ms << ETag("alt");
        }
@@ -2013,7 +2014,7 @@ void InsetMathHull::htmlize(HtmlStream & os) const
 // and we simply do not have that in InsetMathGrid.
 void InsetMathHull::mathmlize(MathStream & os) const
 {
-       bool havenumbers = haveNumbers();
+       bool const havenumbers = haveNumbers();
        bool const havetable = havenumbers || nrows() > 1 || ncols() > 1;
 
        if (havetable)