X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathTabular.cpp;h=2c814a38c6511ecf654ef5c693dd008dbeca9d29;hb=1840b5992c9d8b3546812f29cfb742cce05ff947;hp=b951900efd389c1b0e309ccfa7411137f37b190d;hpb=ecb715d682762ae9a68ca8837f624e31741e3ce9;p=lyx.git diff --git a/src/mathed/InsetMathTabular.cpp b/src/mathed/InsetMathTabular.cpp index b951900efd..2c814a38c6 100644 --- a/src/mathed/InsetMathTabular.cpp +++ b/src/mathed/InsetMathTabular.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author André Pönitz + * \author André Pönitz * * Full author contact details are available in file CREDITS. */ @@ -22,14 +22,15 @@ namespace lyx { -InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n) - : InsetMathGrid(m, n), name_(name) +InsetMathTabular::InsetMathTabular(Buffer * buf, docstring const & name, int m, + int n) + : InsetMathGrid(buf, m, n), name_(name) {} -InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n, - char valign, docstring const & halign) - : InsetMathGrid(m, n, valign, halign), name_(name) +InsetMathTabular::InsetMathTabular(Buffer * buf, docstring const & name, int m, + int n, char valign, docstring const & halign) + : InsetMathGrid(buf, m, n, valign, halign), name_(name) {} @@ -65,9 +66,12 @@ void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const void InsetMathTabular::write(WriteStream & os) const { + ModeSpecifier specifier(os, TEXT_MODE); + if (os.fragile()) os << "\\protect"; os << "\\begin{" << name_ << '}'; + bool open = os.startOuterRow(); char const v = verticalAlignment(); if (v == 't' || v == 'b') @@ -79,6 +83,8 @@ void InsetMathTabular::write(WriteStream & os) const if (os.fragile()) os << "\\protect"; os << "\\end{" << name_ << '}'; + if (open) + os.startOuterRow(); // adding a \n here is bad if the tabular is the last item // in an \eqnarray... }