Color schemes: Fix wrong colors for unset values

Defaulting to C_TEXT in that case is correct, but the values
for C_TEXT are set via the palette, so other display features like
the current line highlighting and the block visualization,
which are painted _below_ the text, are not overridden.

So, the correct way for a style to set the same foreground and
background colors as C_TEXT, is to leave these colors unset.

Fixes: QTCREATORBUG-21661
Change-Id: I8cdb73e8edc5e3883e1ef107bd1c2b29e6d75b9c
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2018-12-10 10:36:28 +01:00
parent 4cb4b7ba99
commit f1e929f0e7

View File

@@ -406,12 +406,9 @@ bool FontSettings::loadColorScheme(const QString &fileName,
if (!m_scheme.contains(id)) {
Format format;
const Format &descFormat = desc.format();
if (descFormat == format && m_scheme.contains(C_TEXT)) {
// Default format -> Text
const Format textFormat = m_scheme.formatFor(C_TEXT);
format.setForeground(textFormat.foreground());
format.setBackground(textFormat.background());
} else {
// Default fallback for background and foreground is C_TEXT, which is set through
// the editor's palette, i.e. we leave these as invalid colors in that case
if (descFormat != format || !m_scheme.contains(C_TEXT)) {
format.setForeground(descFormat.foreground());
format.setBackground(descFormat.background());
}