Skip to content

Commit df3acff

Browse files
authored
fix: extra empty lines in diff (Windows) (#2015)
When using CR/LF as newline on Windows, there were extra empty lines shown in diffs. Commit b84b79 fixed a regression (#1996) by keeping CRs as content of diff lines instead of removing them. Additionally since commit 796f88 (#1543) the output for diffs uses the default newline depending on platform, that's CR/LF on Windows. As consequence on Windows with files containing CR/LF as newlines the content (ending in CR) and the default newline CR/LF resulted in CR CR LF, which is interpreted as two line breaks instead of one. So b84b79 introduced itself a regression that's fixed in this commit by partially reverting commit 796f88. This fixes #2001.
1 parent 283f84f commit df3acff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Views/TextDiffView.axaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ protected override void OnDataContextChanged(EventArgs e)
931931
if (line.NoNewLineEndOfFile)
932932
builder.Append("\u26D4");
933933

934-
builder.AppendLine();
934+
builder.Append('\n');
935935
}
936936

937937
Text = builder.ToString();
@@ -1121,7 +1121,7 @@ protected override void OnDataContextChanged(EventArgs e)
11211121
if (line.NoNewLineEndOfFile)
11221122
builder.Append("\u26D4");
11231123

1124-
builder.AppendLine();
1124+
builder.Append('\n');
11251125
}
11261126

11271127
Text = builder.ToString();

0 commit comments

Comments
 (0)