mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -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();
|
var builder = new StringBuilder();
|
||||||
foreach (var line in textDiff.Lines)
|
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);
|
builder.AppendLine(line.Content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Text = builder.ToString();
|
Text = builder.ToString();
|
||||||
}
|
}
|
||||||
|
@ -718,7 +729,18 @@ namespace SourceGit.Views
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
var lines = IsOld ? diff.Old : diff.New;
|
var lines = IsOld ? diff.Old : diff.New;
|
||||||
foreach (var line in lines)
|
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);
|
builder.AppendLine(line.Content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Text = builder.ToString();
|
Text = builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue