From b983c2c5bec6ed60749fc3f0096201ca0aabcee7 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Sat, 6 Nov 2010 15:24:37 +0000 Subject: [PATCH] Fix bug #7019 (Math labels should not be escaped on saving) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@36164 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathGrid.cpp | 5 +++-- src/mathed/InsetMathGrid.h | 3 ++- src/mathed/InsetMathHull.cpp | 14 +++++++++----- src/mathed/InsetMathHull.h | 3 ++- status.16x | 2 ++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index 7dc261850a..73e1bcc91c 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -634,7 +634,8 @@ void InsetMathGrid::drawT(TextPainter & /*pain*/, int /*x*/, int /*y*/) const } -docstring InsetMathGrid::eolString(row_type row, bool fragile, bool last_eoln) const +docstring InsetMathGrid::eolString(row_type row, bool fragile, bool /*latex*/, + bool last_eoln) const { docstring eol; @@ -1006,7 +1007,7 @@ void InsetMathGrid::write(WriteStream & os) const ModeSpecifier specifier(os, TEXT_MODE); os << eocString(col, lastcol); } - eol = eolString(row, os.fragile(), last_eoln); + eol = eolString(row, os.fragile(), os.latex(), last_eoln); os << eol; // append newline only if line wasn't completely empty // and this was not the last line in the grid diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h index e74349cf3e..421d0e5953 100644 --- a/src/mathed/InsetMathGrid.h +++ b/src/mathed/InsetMathGrid.h @@ -230,7 +230,8 @@ protected: /// returns y offset of cell compared to inset int cellYOffset(idx_type idx) const; /// returns proper 'end of line' code for LaTeX - virtual docstring eolString(row_type row, bool fragile, bool last_eoln) const; + virtual docstring eolString(row_type row, bool fragile, bool latex, + bool last_eoln) const; /// returns proper 'end of column' code for LaTeX virtual docstring eocString(col_type col, col_type lastcol) const; /// splits cells and shifts right part to the next cell diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index c3167226c0..2d4ba5f0fd 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1071,19 +1071,23 @@ void InsetMathHull::mutate(HullType newtype) } -docstring InsetMathHull::eolString(row_type row, bool fragile, bool last_eoln) const +docstring InsetMathHull::eolString(row_type row, bool fragile, bool latex, + bool last_eoln) const { docstring res; if (numberedType()) { - if (label_[row] && !nonum_[row]) - res += "\\label{" + - escape(label_[row]->getParam("name")) + '}'; + if (label_[row] && !nonum_[row]) { + docstring const name = + latex ? escape(label_[row]->getParam("name")) + : label_[row]->getParam("name"); + res += "\\label{" + name + '}'; + } if (nonum_[row] && (type_ != hullMultline)) res += "\\nonumber "; } // Never add \\ on the last empty line of eqnarray and friends last_eoln = false; - return res + InsetMathGrid::eolString(row, fragile, last_eoln); + return res + InsetMathGrid::eolString(row, fragile, latex, last_eoln); } diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 49863558d3..a4cebf6774 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -155,7 +155,8 @@ protected: bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const; /// - docstring eolString(row_type row, bool fragile, bool last_eoln) const; + docstring eolString(row_type row, bool fragile, bool latex, + bool last_eoln) const; private: virtual Inset * clone() const; diff --git a/status.16x b/status.16x index 12aa9a8dc7..af80d61679 100644 --- a/status.16x +++ b/status.16x @@ -116,6 +116,8 @@ What's new - Save the path of pasted images as a relative path (part of bug 5561). +- Don't escape math labels when saving (bug 7019). + * USER INTERFACE