diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-08-23 11:32:12 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-08-24 08:15:21 +0000 |
commit | 601eebd832e8f8a39d661031a44d5ee3c53bf718 (patch) | |
tree | 907773e7f7397f287c0f56ac32877cfa6df71726 /src/plugins/texteditor/generichighlighter | |
parent | bba35ceff46bc0c6b4338d9a2e33389c783329f9 (diff) |
Fix painting of current line in generic and python editors
The generic highlighter and the python editor explicitly map some tokens
to the format C_TEXT. Unfortunately this format is special, because it's
foreground and background colors are handled by setting the editor's
palette, and should not be used for setting the format on characters.
If the format is explicitly set on characters, their background will be
oblique and overpaint e.g. the highlight for the current line, which
looks pretty ugly.
Handle this directly in SyntaxHighlighter::formatForCategory for all
syntax highlighters, by returning an empty QTextCharFormat for C_TEXT.
Change-Id: Ifaeb556754ca8106ad6e55d7062b13b45457a809
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/generichighlighter')
-rw-r--r-- | src/plugins/texteditor/generichighlighter/highlighter.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp index e7e5e713ab..8ece3f462e 100644 --- a/src/plugins/texteditor/generichighlighter/highlighter.cpp +++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp @@ -23,17 +23,19 @@ ** ****************************************************************************/ -#include "highlighter.h" -#include "highlightdefinition.h" #include "context.h" -#include "rule.h" -#include "itemdata.h" +#include "highlightdefinition.h" +#include "highlighter.h" #include "highlighterexception.h" +#include "itemdata.h" #include "progressdata.h" #include "reuse.h" +#include "rule.h" #include "tabsettings.h" #include <coreplugin/messagemanager.h> +#include <texteditor/fontsettings.h> +#include <texteditor/texteditorsettings.h> #include <utils/qtcassert.h> #include <QCoreApplication> @@ -567,7 +569,7 @@ void Highlighter::applyFormat(int offset, // think this approach would fit better. If there are other ideas... QBrush bg = format.background(); if (bg.style() == Qt::NoBrush) - bg = formatForCategory(C_TEXT).background(); + bg = TextEditorSettings::fontSettings().toTextCharFormat(C_TEXT).background(); if (itemData->color().isValid() && isReadableOn(bg.color(), itemData->color())) format.setForeground(itemData->color()); if (itemData->isItalicSpecified()) |