forked from qt-creator/qt-creator
TextEditor: Fix highlighting for mixins
The color from mix-ins should be always override the previous color. It should only be tested for relative colors. It looks like the branches was mixed up. Change-Id: I9b8602ab65cab65f0df8ec2c111845cf2d8d33cf Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -228,21 +228,23 @@ void FontSettings::addMixinStyle(QTextCharFormat &textCharFormat,
|
|||||||
for (TextStyle mixinStyle : mixinStyles) {
|
for (TextStyle mixinStyle : mixinStyles) {
|
||||||
const Format &format = m_scheme.formatFor(mixinStyle);
|
const Format &format = m_scheme.formatFor(mixinStyle);
|
||||||
|
|
||||||
if (textCharFormat.hasProperty(QTextFormat::ForegroundBrush)) {
|
if (format.foreground().isValid()) {
|
||||||
if (format.foreground().isValid())
|
textCharFormat.setForeground(format.foreground());
|
||||||
textCharFormat.setForeground(format.foreground());
|
} else {
|
||||||
else
|
if (textCharFormat.hasProperty(QTextFormat::ForegroundBrush)) {
|
||||||
textCharFormat.setForeground(mixBrush(textCharFormat.foreground(),
|
textCharFormat.setForeground(mixBrush(textCharFormat.foreground(),
|
||||||
format.relativeForegroundSaturation(),
|
format.relativeForegroundSaturation(),
|
||||||
format.relativeForegroundLightness()));
|
format.relativeForegroundLightness()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (textCharFormat.hasProperty(QTextFormat::BackgroundBrush)) {
|
if (format.background().isValid()) {
|
||||||
if (format.background().isValid())
|
textCharFormat.setBackground(format.background());
|
||||||
textCharFormat.setBackground(format.background());
|
} else {
|
||||||
else
|
if (textCharFormat.hasProperty(QTextFormat::BackgroundBrush)) {
|
||||||
textCharFormat.setBackground(mixBrush(textCharFormat.background(),
|
textCharFormat.setBackground(mixBrush(textCharFormat.background(),
|
||||||
format.relativeBackgroundSaturation(),
|
format.relativeBackgroundSaturation(),
|
||||||
format.relativeBackgroundLightness()));
|
format.relativeBackgroundLightness()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!textCharFormat.fontItalic())
|
if (!textCharFormat.fontItalic())
|
||||||
textCharFormat.setFontItalic(format.italic());
|
textCharFormat.setFontItalic(format.italic());
|
||||||
|
|||||||
Reference in New Issue
Block a user