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

Improve hunk separation styling

parent e4194670
Pipeline #226840 passed with stage
in 5 minutes and 23 seconds
......@@ -30,6 +30,7 @@ DiffEditor::DiffEditor(DiffParams::Flags f, QWidget *parent)
auto bg = QColor::fromRgba(theme.editorColor(Theme::EditorColorRole::BackgroundColor));
auto fg = QColor::fromRgba(theme.textColor(Theme::TextStyle::Normal));
auto sel = QColor::fromRgba(theme.editorColor(Theme::EditorColorRole::TextSelection));
hunkSeparatorColor = QColor::fromRgba(theme.textColor(Theme::TextStyle::Keyword));
auto pal = palette();
pal.setColor(QPalette::Base, bg);
pal.setColor(QPalette::Text, fg);
......@@ -227,7 +228,7 @@ void DiffEditor::paintEvent(QPaintEvent *e)
const auto viewportRect = viewport()->rect();
while (block.isValid()) {
QRectF r = blockBoundingRect(block).translated(offset);
const QRectF r = blockBoundingRect(block).translated(offset);
auto layout = block.layout();
auto hl = highlightingForLine(block.blockNumber());
......@@ -275,11 +276,13 @@ void DiffEditor::paintEvent(QPaintEvent *e)
if (block.text().startsWith(QStringLiteral("@@ "))) {
p.save();
p.setPen(Qt::red);
QPen pen;
pen.setColor(hunkSeparatorColor);
pen.setWidthF(1.1);
p.setPen(pen);
p.setBrush(Qt::NoBrush);
QRectF copy = r;
copy.setRight(copy.right() - 1);
p.drawRect(copy);
p.drawLine(r.topLeft(), r.topRight());
p.drawLine(r.bottomLeft(), r.bottomRight());
p.restore();
}
......
......@@ -78,6 +78,7 @@ private:
QColor red2;
QColor green1;
QColor green2;
QColor hunkSeparatorColor;
class LineNumArea *const m_lineNumArea;
class DiffWidget *const m_diffWidget;
DiffParams::Flags m_flags;
......
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