]> git.lyx.org Git - features.git/commitdiff
* correct color for the unique part of the completion in RTL
authorStefan Schimanski <sts@lyx.org>
Thu, 28 Feb 2008 12:42:58 +0000 (12:42 +0000)
committerStefan Schimanski <sts@lyx.org>
Thu, 28 Feb 2008 12:42:58 +0000 (12:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23315 a592a061-630c-0410-9148-cb99ea01b6c8

src/rowpainter.cpp

index cc10856e51d558554216f955791d184bcf3c39e9..22b591e5c9132a521c5ddcb48a2f114a80c0d44f 100644 (file)
@@ -813,10 +813,7 @@ void RowPainter::paintInlineCompletion(Font const & font)
 {
        docstring completion = pi_.base.bv->inlineCompletion();
        FontInfo f = font.fontInfo();
-       
-       // right to left?
-       if (font.isRightToLeft())
-               reverse(completion.begin(), completion.end());
+       bool rtl = font.isRightToLeft();
        
        // draw the unique and the non-unique completion part
        // Note: this is not time-critical as it is
@@ -824,15 +821,25 @@ void RowPainter::paintInlineCompletion(Font const & font)
        size_t uniqueTo = pi_.base.bv->inlineCompletionUniqueChars();
        docstring s1 = completion.substr(0, uniqueTo);
        docstring s2 = completion.substr(uniqueTo);
+       ColorCode c1 = Color_inlinecompletion;
+       ColorCode c2 = Color_nonunique_inlinecompletion;
        
+       // right to left?
+       if (rtl) {
+               swap(s1, s2);
+               reverse(s1.begin(), s1.end());
+               reverse(s2.begin(), s2.end());
+               swap(c1, c2);
+       }
+
        if (s1.size() > 0) {
-               f.setColor(Color_inlinecompletion);
+               f.setColor(c1);
                pi_.pain.text(int(x_), yo_, s1, f);
                x_ += theFontMetrics(font).width(s1);
        }
        
        if (s2.size() > 0) {
-               f.setColor(Color_nonunique_inlinecompletion);
+               f.setColor(c2);
                pi_.pain.text(int(x_), yo_, s2, f);
                x_ += theFontMetrics(font).width(s2);
        }