commit 1b5ccecd65a795ba4ff21aa5733fa18866fefd1c
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Thu Sep 20 23:51:21 2018 +0200

    Avoid space before completion in mathed
    
    This can happen if the current element has space after it (e.g. before
    a relation).
    
    Fixes bug #11283.
---
 src/mathed/MathRow.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mathed/MathRow.cpp b/src/mathed/MathRow.cpp
index c2b1a00..472b6db 100644
--- a/src/mathed/MathRow.cpp
+++ b/src/mathed/MathRow.cpp
@@ -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);
                }
        }

Reply via email to