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
e59246d5
Commit
e59246d5
authored
Sep 04, 2022
by
Waqar Ahmed
Browse files
Fix line numbers in multi-file diffs
parent
f7919028
Changes
1
Hide whitespace changes
Inline
Side-by-side
apps/lib/diff/diffwidget.cpp
View file @
e59246d5
...
...
@@ -548,6 +548,8 @@ void DiffWidget::parseAndShowDiff(const QByteArray &raw)
// Start of a new file
markInlineDiffs
(
hunkChangedLinesA
,
hunkChangedLinesB
,
leftHlts
,
rightHlts
);
// add new line
lineNumsA
.
append
(
-
1
);
lineNumsB
.
append
(
-
1
);
left
.
append
(
QString
());
right
.
append
(
QString
());
lineA
+=
1
;
...
...
@@ -618,8 +620,6 @@ void DiffWidget::parseAndShowDiffUnified(const QByteArray &raw)
for
(
int
i
=
0
;
i
<
text
.
size
();
++
i
)
{
const
QString
&
line
=
text
.
at
(
i
);
auto
match
=
DIFF_FILENAME_RE
.
match
(
line
);
if
(
match
.
hasMatch
())
{
if
(
line
.
startsWith
(
QLatin1Char
(
'-'
)))
{
srcFile
=
match
.
captured
(
1
);
}
else
if
(
line
.
startsWith
(
QLatin1Char
(
'+'
)))
{
tgtFile
=
match
.
captured
(
1
);
...
...
@@ -708,6 +708,7 @@ void DiffWidget::parseAndShowDiffUnified(const QByteArray &raw)
markInlineDiffs
(
hunkChangedLinesA
,
hunkChangedLinesB
,
hlts
,
hlts
);
// add new line
lines
.
append
(
QString
());
lineNums
.
append
(
-
1
);
lineNo
+=
1
;
break
;
}
...
...
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