diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 88fe021ebf..576bc67811 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -3067,18 +3067,16 @@ void BufferView::caretPosAndDim(Point & p, Dimension & dim) const Cursor const & cur = cursor(); if (cur.inMathed()) { MathRow const & mrow = mathRow(&cur.cell()); - dim.asc = mrow.caret_ascent; - dim.des = mrow.caret_descent; + dim = mrow.caret_dim; } else { Font const font = cur.real_current_font; frontend::FontMetrics const & fm = theFontMetrics(font); + dim.wid = fm.lineWidth(); dim.asc = fm.maxAscent(); dim.des = fm.maxDescent(); } if (lyxrc.cursor_width > 0) dim.wid = lyxrc.cursor_width; - else - dim.wid = 1 + int((lyxrc.currentZoom + 50) / 200.0); p = getPos(cur); p.y_ -= dim.asc; diff --git a/src/LyXRC.h b/src/LyXRC.h index 3ebecb7c19..8950ea511c 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -560,7 +560,7 @@ public: ScrollWheelZoom scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL; // FIXME: should be caret_width /// - int cursor_width = 1; + int cursor_width = 0; /// One of: yes, no, ask std::string close_buffer_with_last_view = "yes"; }; diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index 868321b086..39d5f80184 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -295,10 +295,12 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim, bool tight) const // This is one of the the few points where the drawing font is known, // 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()); + mrow.caret_dim.asc = min(dim.asc, fm.maxAscent()); + mrow.caret_dim.des = min(dim.des, fm.maxDescent()); + mrow.caret_dim.wid = fm.lineWidth(); + /// do the same for math cells linearized in the row - MathRow caret_row = MathRow(mrow.caret_ascent, mrow.caret_descent); + MathRow caret_row = MathRow(mrow.caret_dim); for (auto const & e : mrow) if (e.type == MathRow::BEGIN && e.ar) bv->setMathRow(e.ar, caret_row); diff --git a/src/mathed/MathRow.h b/src/mathed/MathRow.h index 6d1a410372..f2b0445a0b 100644 --- a/src/mathed/MathRow.h +++ b/src/mathed/MathRow.h @@ -16,6 +16,7 @@ #include "MathClass.h" #include "ColorCode.h" +#include "Dimension.h" #include "support/docstring.h" @@ -86,7 +87,9 @@ public: }; /// - MathRow(int asc = 0, int des = 0) : caret_ascent(asc), caret_descent(des) {}; + MathRow() {} + /// + MathRow(Dimension const & dim) : caret_dim(dim) {} /// typedef std::vector Elements; /// @@ -119,7 +122,7 @@ public: int kerning(BufferView const *) const; /// useful when the caret visits this cell - int caret_ascent, caret_descent; + Dimension caret_dim; private: