From f1e929f0e75a928650c1b257783fd0a9eb8b450c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 10 Dec 2018 10:36:28 +0100 Subject: [PATCH] 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 Reviewed-by: David Schulz --- src/plugins/texteditor/fontsettings.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index 9c6667d00c5..bc8d8c4d1a8 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -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()); }