code_review: PR #1177

- use `Command.ReadToEnd` instead of `Command.Exec` to avoid git trims line endings.
- use `StringBuilder.Append('\n')` instead of `StringBuilder.AppendLine()` to restore original line endings (we split the original diff output by `\n` not `\r')
- there's no need to show file content (the `StreamReader.ReadLine()` will trim line endings)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-04-14 16:06:52 +08:00
parent 81820e7034
commit e89dbd8f43
No known key found for this signature in database
3 changed files with 31 additions and 53 deletions

View file

@ -1253,11 +1253,12 @@ namespace SourceGit.Views
{
builder.Append(line.Content.Substring(0, 1000));
builder.Append($"...({line.Content.Length - 1000} character trimmed)");
builder.AppendLine();
builder.Append('\n');
}
else
{
builder.AppendLine(line.Content);
builder.Append(line.Content);
builder.Append('\n');
}
}
@ -1492,11 +1493,12 @@ namespace SourceGit.Views
{
builder.Append(line.Content.Substring(0, 1000));
builder.Append($"...({line.Content.Length - 1000} characters trimmed)");
builder.AppendLine();
builder.Append('\n');
}
else
{
builder.AppendLine(line.Content);
builder.Append(line.Content);
builder.Append('\n');
}
}