Commit 3188a5ab authored by Eike Ziller's avatar Eike Ziller

Fix style of whitespace in diff description

Task-number: QTCREATORBUG-9445
Change-Id: I1c60181b7e15c66b88cc1d5ec7584951d3aa46a0
Reviewed-by: Jaroslaw Kobus's avatarJarek Kobus <jaroslaw.kobus@qt.io>
parent c04569a0
......@@ -35,6 +35,8 @@
#include <texteditor/displaysettings.h>
#include <texteditor/marginsettings.h>
#include <texteditor/syntaxhighlighter.h>
#include <texteditor/textdocument.h>
#include <texteditor/texteditor.h>
#include <texteditor/texteditorsettings.h>
......@@ -120,6 +122,8 @@ DescriptionEditorWidget::DescriptionEditorWidget(QWidget *parent)
m_context->setWidget(this);
m_context->setContext(Core::Context(Constants::C_DIFF_EDITOR_DESCRIPTION));
Core::ICore::addContextObject(m_context);
textDocument()->setSyntaxHighlighter(new SyntaxHighlighter);
}
DescriptionEditorWidget::~DescriptionEditorWidget()
......
......@@ -819,6 +819,11 @@ QTextCharFormat SyntaxHighlighter::formatForCategory(int category) const
return d->formats.at(category);
}
void SyntaxHighlighter::highlightBlock(const QString &text)
{
formatSpaces(text);
}
void SyntaxHighlighterPrivate::updateFormats(const FontSettings &fontSettings)
{
for (const auto &pair : Utils::asConst(formatCategories))
......
......@@ -78,7 +78,10 @@ protected:
void setDefaultTextFormatCategories();
void setTextFormatCategories(int count, std::function<TextStyle(int)> formatMapping);
QTextCharFormat formatForCategory(int categoryIndex) const;
virtual void highlightBlock(const QString &text) = 0;
// implement in subclasses
// default implementation highlights whitespace
virtual void highlightBlock(const QString &text);
void setFormat(int start, int count, const QTextCharFormat &format);
void setFormat(int start, int count, const QColor &color);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment