]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathData.cpp
Preserve \inputencoding value when switching to non-TeX fonts.
[lyx.git] / src / mathed / MathData.cpp
index c3b3faa2395f38731b74031ca11dc9be3929047f..0676dc732a7b72490c428331f12ec669f4931a93 100644 (file)
@@ -267,18 +267,6 @@ bool isInside(DocIterator const & it, MathData const & ar,
 #endif
 
 
-int MathData::caretAscent(BufferView const * bv) const
-{
-       return mrow_cache_[bv].caret_ascent;
-}
-
-
-int MathData::caretDescent(BufferView const * bv) const
-{
-       return mrow_cache_[bv].caret_descent;
-}
-
-
 void MathData::metrics(MetricsInfo & mi, Dimension & dim, bool tight) const
 {
        frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
@@ -310,9 +298,14 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim, bool tight) const
        // so that we can set the caret vertical dimensions.
        mrow.caret_ascent = min(dim.asc, fm.maxAscent());
        mrow.caret_descent = min(dim.des, fm.maxDescent());
+       /// do the same for math cells linearized in the row
+       MathRow caret_row = MathRow(mrow.caret_ascent, mrow.caret_descent);
+       for (auto const & e : mrow)
+               if (e.type == MathRow::BEGIN && e.ar)
+                       bv->setMathRow(e.ar, caret_row);
 
        // Cache row and dimension.
-       mrow_cache_[bv] = mrow;
+       bv->setMathRow(this, mrow);
        bv->coordCache().arrays().add(this, dim);
 }
 
@@ -357,7 +350,7 @@ void MathData::draw(PainterInfo & pi, int const x, int const y) const
        setXY(*pi.base.bv, x, y);
 
        drawSelection(pi, x, y);
-       MathRow const & mrow = mrow_cache_[pi.base.bv];
+       MathRow const & mrow = pi.base.bv->mathRow(this);
        mrow.draw(pi, x, y);
 }