Commit e8259181 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Diff: Dont highlight errors

parent 92750179
......@@ -13,6 +13,15 @@
#include <QTextBlock>
#include <KLocalizedString>
#include <KSyntaxHighlighting/Format>
void DiffSyntaxHighlighter::applyFormat(int offset, int length, const KSyntaxHighlighting::Format &format)
{
if (format.textStyle() == KSyntaxHighlighting::Theme::TextStyle::Error) {
return;
}
KSyntaxHighlighting::SyntaxHighlighter::applyFormat(offset, length, format);
}
DiffEditor::DiffEditor(DiffParams::Flags f, QWidget *parent)
: QPlainTextEdit(parent)
......
......@@ -9,6 +9,21 @@
#include <KTextEditor/Range>
#include <QPlainTextEdit>
#include <KSyntaxHighlighting/FoldingRegion>
#include <KSyntaxHighlighting/SyntaxHighlighter>
class DiffSyntaxHighlighter final : public KSyntaxHighlighting::SyntaxHighlighter
{
public:
using KSyntaxHighlighting::SyntaxHighlighter::SyntaxHighlighter;
void applyFormat(int offset, int length, const KSyntaxHighlighting::Format &format) override;
void applyFolding(int, int, KSyntaxHighlighting::FoldingRegion) override
{
// no folding
}
};
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
using IntT = qsizetype;
#else
......
......@@ -22,7 +22,6 @@
#include <KSyntaxHighlighting/Definition>
#include <KSyntaxHighlighting/Format>
#include <KSyntaxHighlighting/Repository>
#include <KSyntaxHighlighting/SyntaxHighlighter>
DiffWidget::DiffWidget(DiffParams p, QWidget *parent)
: QWidget(parent)
......@@ -34,8 +33,8 @@ DiffWidget::DiffWidget(DiffParams p, QWidget *parent)
layout->addWidget(m_left);
layout->addWidget(m_right);
leftHl = new KSyntaxHighlighting::SyntaxHighlighter(m_left->document());
rightHl = new KSyntaxHighlighting::SyntaxHighlighter(m_right->document());
leftHl = new DiffSyntaxHighlighter(m_left->document());
rightHl = new DiffSyntaxHighlighter(m_right->document());
leftHl->setTheme(KTextEditor::Editor::instance()->theme());
rightHl->setTheme(KTextEditor::Editor::instance()->theme());
......
Supports Markdown
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