Try to reduce the use of CoordCache::insets().dim()

The debug code does not needed it. The code in Cursor is only used in
mathed.
This commit is contained in:
Jean-Marc Lasgouttes 2024-11-29 11:52:57 +01:00
parent 6701a5d55c
commit d19f4319dc
2 changed files with 5 additions and 4 deletions

View File

@ -2551,6 +2551,8 @@ void Cursor::checkBufferStructure()
void Cursor::moveToClosestEdge(int const x, bool const edit)
{
if (Inset const * inset = nextInset()) {
// This is only used in mathed.
LATTEST(inset->asInsetMath());
// stay in front of insets for which we want to open the dialog
// (e.g. InsetMathSpace).
if (edit && (inset->hasSettings() || !inset->contextMenuName().empty()))

View File

@ -125,10 +125,9 @@ void RowPainter::paintInset(Row::Element const & e) const
pi_.selected = pi_selected;
#ifdef DEBUG_METRICS
Dimension const & dim = pi_.base.bv->coordCache().insets().dim(e.inset);
int const x2 = x1 + dim.wid;
int const y1 = yo_ + dim.des;
int const y2 = yo_ - dim.asc;
int const x2 = x1 + e.dim.wid;
int const y1 = yo_ + e.dim.des;
int const y2 = yo_ - e.dim.asc;
pi_.pain.line(x1, y1, x1, y2, Color_green);
pi_.pain.line(x1, y1, x2, y1, Color_green);
pi_.pain.line(x2, y1, x2, y2, Color_green);