From: Jean-Marc Lasgouttes Date: Tue, 9 Apr 2019 09:29:20 +0000 (+0200) Subject: Fix bold-like characters when selecting bidi text X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=2bb95ca3c8e82e218429d7eda6ca3f450dbd2492;p=features.git Fix bold-like characters when selecting bidi text In painter, restrting paining regions does not really work when region is empty. Fixes bug #11198. --- diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index e0b2177c92..c1f3677815 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -362,7 +362,11 @@ void GuiPainter::text(int x, int y, docstring const & str, Font const & f, int const height = fm.maxAscent() + fm.maxDescent(); int xmin = fm.pos2x(str, from, dir == RtL, wordspacing); int xmax = fm.pos2x(str, to, dir == RtL, wordspacing); - if (xmin > xmax) + // Avoid this case, since it would make the `other' text spill in some cases + if (xmin == xmax) { + text(x, y, str, fi, dir, wordspacing, tw); + return; + } else if (xmin > xmax) swap(xmin, xmax); // First the part in other color