diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 603d223a9..4988b622a 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -685,6 +685,7 @@
APPEARANCE
Default Font
Editor Tab Width
+ Max Diff Line Length (0 = unlimited)
Font Size
Default
Editor
@@ -831,7 +832,7 @@
Filter in commit graph
filter(s) enabled
Focus on Current Branch
-
+
When this is toggled, all history filters will be cleared. And only commits belong to the current branch or its upstream (if it has one) will be listed in `Dashboard` page.
Manually add a branch/tag history filter will disable this feature automatically.
diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs
index 9d9fb3f9f..0b6a7cad1 100644
--- a/src/ViewModels/Preferences.cs
+++ b/src/ViewModels/Preferences.cs
@@ -105,6 +105,12 @@ public int EditorTabWidth
set => SetProperty(ref _editorTabWidth, value);
}
+ public int MaxDiffLineLength
+ {
+ get => _maxDiffLineLength;
+ set => SetProperty(ref _maxDiffLineLength, Math.Max(0, value));
+ }
+
public double Zoom
{
get => _zoom;
@@ -797,6 +803,7 @@ private bool RemoveInvalidRepositoriesRecursive(List collection)
private double _defaultFontSize = 13;
private double _editorFontSize = 13;
private int _editorTabWidth = 4;
+ private int _maxDiffLineLength = 1000;
private double _zoom = 1.0;
private LayoutInfo _layout = new();
diff --git a/src/Views/MergeConflictEditor.axaml.cs b/src/Views/MergeConflictEditor.axaml.cs
index 79e9c961e..dd65f9021 100644
--- a/src/Views/MergeConflictEditor.axaml.cs
+++ b/src/Views/MergeConflictEditor.axaml.cs
@@ -379,12 +379,13 @@ private void UpdateContent()
}
var builder = new StringBuilder();
+ var maxLineLength = ViewModels.Preferences.Instance.MaxDiffLineLength;
foreach (var line in lines)
{
- if (line.Content.Length > 1000)
+ if (maxLineLength > 0 && line.Content.Length > maxLineLength)
{
- builder.Append(line.Content.AsSpan(0, 1000));
- builder.Append($"...({line.Content.Length - 1000} characters trimmed)");
+ builder.Append(line.Content.AsSpan(0, maxLineLength));
+ builder.Append($"...({line.Content.Length - maxLineLength} characters trimmed)");
}
else
{
diff --git a/src/Views/Preferences.axaml b/src/Views/Preferences.axaml
index 6b3aa863c..3bc677d1b 100644
--- a/src/Views/Preferences.axaml
+++ b/src/Views/Preferences.axaml
@@ -188,7 +188,7 @@
-
+
+
+
+
-
-
+
diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs
index ee8b41245..5a6d44507 100644
--- a/src/Views/TextDiffView.axaml.cs
+++ b/src/Views/TextDiffView.axaml.cs
@@ -1012,12 +1012,13 @@ protected override void OnDataContextChanged(EventArgs e)
if (DataContext is ViewModels.CombinedTextDiff { Data: { } diff })
{
var builder = new StringBuilder();
+ var maxLineLength = ViewModels.Preferences.Instance.MaxDiffLineLength;
foreach (var line in diff.Lines)
{
- if (line.Content.Length > 1000)
+ if (maxLineLength > 0 && line.Content.Length > maxLineLength)
{
- builder.Append(line.Content.AsSpan(0, 1000));
- builder.Append($"...({line.Content.Length - 1000} characters trimmed)");
+ builder.Append(line.Content.AsSpan(0, maxLineLength));
+ builder.Append($"...({line.Content.Length - maxLineLength} characters trimmed)");
}
else
{
@@ -1211,12 +1212,13 @@ protected override void OnDataContextChanged(EventArgs e)
{
var builder = new StringBuilder();
var lines = IsOld ? diff.Old : diff.New;
+ var maxLineLength = ViewModels.Preferences.Instance.MaxDiffLineLength;
foreach (var line in lines)
{
- if (line.Content.Length > 1000)
+ if (maxLineLength > 0 && line.Content.Length > maxLineLength)
{
- builder.Append(line.Content.AsSpan(0, 1000));
- builder.Append($"...({line.Content.Length - 1000} characters trimmed)");
+ builder.Append(line.Content.AsSpan(0, maxLineLength));
+ builder.Append($"...({line.Content.Length - maxLineLength} characters trimmed)");
}
else
{