]> git.lyx.org Git - features.git/commitdiff
Fix painting of selection with change tracking
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 28 Oct 2015 09:29:48 +0000 (10:29 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 28 Oct 2015 09:40:10 +0000 (10:40 +0100)
When partially selecting an element, the selected text color was not
the same as when selecting it completely.

Fixes bug #9809.

src/RowPainter.cpp

index 3c19fbc7431f3fdbdd73fc775098f5d16b326681..ce5780bb4c65b8bf4c7031c04b380ce80cae4503 100644 (file)
@@ -243,13 +243,11 @@ void RowPainter::paintStringAndSel(Row::Element const & e)
        bool const all_sel = (e.pos >= row_.sel_beg && e.endpos < row_.sel_end)
                || pi_.selected;
 
-       if (all_sel) {
+       if (all_sel || e.change.changed()) {
                Font copy = e.font;
-               copy.fontInfo().setPaintColor(Color_selectiontext);
-               pi_.pain.text(int(x_), yo_, e.str, copy, e.extra);
-       } else if (e.change.changed()) {
-               Font copy = e.font;
-               copy.fontInfo().setPaintColor(e.change.color());
+               Color const col = e.change.changed() ? e.change.color()
+                                                    : Color_selectiontext;
+               copy.fontInfo().setPaintColor(col);
                pi_.pain.text(int(x_), yo_, e.str, copy, e.extra);
        } else if (!some_sel) {
                pi_.pain.text(int(x_), yo_, e.str, e.font, e.extra);