From f7cd0928ad63f5138b5c90f42a1197795faefd54 Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Thu, 28 Feb 2008 12:42:58 +0000 Subject: [PATCH] * correct color for the unique part of the completion in RTL git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23315 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/rowpainter.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index cc10856e51..22b591e5c9 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -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); } -- 2.39.2