Skip to content

Commit 4380a80

Browse files
committed
Insert empty lines to equalize the length of the input and output
1 parent f766b3f commit 4380a80

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

ClangFormatEditor/DiffStyle/DiffMatchPatchWrapper.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@ private List<string> EqualizeDocumentLength(string input, string output)
282282
if (newLineFoundPerOperation != 0)
283283
{
284284
emptyLinesToAdd += newLineFoundPerOperation;
285+
if(emptyLinesToAdd > 0)
286+
{
287+
for (int i = 0; i < emptyLinesToAdd; i++)
288+
{
289+
lines.Add(Environment.NewLine);
290+
}
291+
}
292+
emptyLinesToAdd = 0;
285293
}
286294
break;
287295
case Operation.INSERT:
@@ -331,15 +339,6 @@ private List<string> EqualizeDocumentLength(string input, string output)
331339
equalLines.RemoveAt(0);
332340
}
333341

334-
// Insert empty lines to equalize the length of the input and output
335-
if (newLineFoundPerOperation > 1)
336-
{
337-
for (int i = 0; i < emptyLinesToAdd; i++)
338-
{
339-
lines.Add(Environment.NewLine);
340-
}
341-
emptyLinesToAdd = 0;
342-
}
343342
lines.AddRange(equalLines);
344343
break;
345344
default:

0 commit comments

Comments
 (0)