From 009e7a61bbf5fb56b724a73028f18c4d80beed45 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 15 Jul 2019 13:02:05 +0200 Subject: [PATCH] Fixup ee0bd36a86: only clear margins when needed The old code would erase text around inline math. Related to #11333. --- src/mathed/InsetMathHull.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index f95859bfe4..261f7f27bb 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -632,6 +632,11 @@ void InsetMathHull::drawBackground(PainterInfo & pi, int x, int y) const dim.wid, dim.asc + dim.des, backgroundColor(pi)); return; } + // If there are numbers, the margins around the (displayed) + // equation have to be cleared. + if (numberedType()) + pi.pain.fillRectangle(pi.leftx, y - dim.asc, + pi.rightx - pi.leftx, dim.height(), pi.background_color); pi.pain.fillRectangle(x + 1, y - dim.asc + 1, dim.wid - 2, dim.asc + dim.des - 1, pi.backgroundColor(this)); } @@ -664,18 +669,12 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const } // First draw the numbers - if (!pi.full_repaint) - pi.pain.fillRectangle(pi.leftx, y - dim.asc, - pi.rightx - pi.leftx, dim.height(), - pi.background_color); - ColorCode color = pi.selected && lyxrc.use_system_colors ? Color_selectiontext : standardColor(); bool const really_change_color = pi.base.font.color() == Color_none; Changer dummy0 = really_change_color ? pi.base.font.changeColor(color) : Changer(); if (numberedType()) { - LATTEST(pi.leftx