]> git.lyx.org Git - lyx.git/commitdiff
Avoid space before completion in mathed
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 20 Sep 2018 21:51:21 +0000 (23:51 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 21 Sep 2018 16:41:08 +0000 (18:41 +0200)
This can happen if the current element has space after it (e.g. before
a relation).

Fixes bug #11283.

(cherry picked from commit 1b5ccecd65a795ba4ff21aa5733fa18866fefd1c)

src/mathed/MathRow.cpp
status.23x

index c2b1a00a430d8b9c435a023cf9365ba6affea090..472b6db927ad476bdf49605da12f7ba9d2abd2c4 100644 (file)
@@ -381,12 +381,14 @@ void MathRow::draw(PainterInfo & pi, int x, int const y) const
 
                if (!s1.empty()) {
                        f.setColor(Color_inlinecompletion);
-                       pi.pain.text(x, y, s1, f);
+                       // offset the text by e.after to make sure that the
+                       // spacing is after the completion, not before.
+                       pi.pain.text(x - e.after, y, s1, f);
                        x += mathed_string_width(f, s1);
                }
                if (!s2.empty()) {
                        f.setColor(Color_nonunique_inlinecompletion);
-                       pi.pain.text(x, y, s2, f);
+                       pi.pain.text(x - e.after, y, s2, f);
                        x += mathed_string_width(f, s2);
                }
        }
index 7f5e56d8139454792d87c0cd565de06c696693a6..d70960c8a306e2e3bd2fed8224ebf1004b9d8d2f 100644 (file)
@@ -126,6 +126,7 @@ What's new
 
 - Improve automatic removal of extra spaces, aka DEPM (bug 10503).
 
+- Avoid white space before math completion (bug 11283).
 
 
 * INTERNALS