Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
d8d757c5
Commit
d8d757c5
authored
Sep 03, 2022
by
Waqar Ahmed
Browse files
Improve hunk separation styling
parent
e4194670
Pipeline
#226840
passed with stage
in 5 minutes and 23 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
apps/lib/diff/diffeditor.cpp
View file @
d8d757c5
...
...
@@ -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
();
}
...
...
apps/lib/diff/diffeditor.h
View file @
d8d757c5
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment