mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
ux: trim text in diff editor if length of line is greater than 10000 (#234)
* ignore WordWrap while trimming text, because displaying the full content content with a length greater than 10000 is meaningless
This commit is contained in:
parent
f4f4a26a64
commit
d822afc4ec
1 changed files with 24 additions and 2 deletions
|
@ -429,7 +429,18 @@ namespace SourceGit.Views
|
|||
{
|
||||
var builder = new StringBuilder();
|
||||
foreach (var line in textDiff.Lines)
|
||||
{
|
||||
if (line.Content.Length > 10000)
|
||||
{
|
||||
builder.Append(line.Content.Substring(0, 1000));
|
||||
builder.Append($"...({line.Content.Length - 1000} character trimmed)");
|
||||
builder.AppendLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendLine(line.Content);
|
||||
}
|
||||
}
|
||||
|
||||
Text = builder.ToString();
|
||||
}
|
||||
|
@ -718,7 +729,18 @@ namespace SourceGit.Views
|
|||
var builder = new StringBuilder();
|
||||
var lines = IsOld ? diff.Old : diff.New;
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (line.Content.Length > 10000)
|
||||
{
|
||||
builder.Append(line.Content.Substring(0, 1000));
|
||||
builder.Append($"...({line.Content.Length - 1000} characters trimmed)");
|
||||
builder.AppendLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendLine(line.Content);
|
||||
}
|
||||
}
|
||||
|
||||
Text = builder.ToString();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue