Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@
<x:String x:Key="Text.Preferences.Appearance" xml:space="preserve">APPEARANCE</x:String>
<x:String x:Key="Text.Preferences.Appearance.DefaultFont" xml:space="preserve">Default Font</x:String>
<x:String x:Key="Text.Preferences.Appearance.EditorTabWidth" xml:space="preserve">Editor Tab Width</x:String>
<x:String x:Key="Text.Preferences.Appearance.MaxDiffLineLength" xml:space="preserve">Max Diff Line Length (0 = unlimited)</x:String>
<x:String x:Key="Text.Preferences.Appearance.FontSize" xml:space="preserve">Font Size</x:String>
<x:String x:Key="Text.Preferences.Appearance.FontSize.Default" xml:space="preserve">Default</x:String>
<x:String x:Key="Text.Preferences.Appearance.FontSize.Editor" xml:space="preserve">Editor</x:String>
Expand Down Expand Up @@ -831,7 +832,7 @@
<x:String x:Key="Text.Repository.FilterCommits.Include" xml:space="preserve">Filter in commit graph</x:String>
<x:String x:Key="Text.Repository.FilterCommits.Summary" xml:space="preserve">filter(s) enabled</x:String>
<x:String x:Key="Text.Repository.FocusOnCurrentBranch" xml:space="preserve">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.</x:String>
Expand Down
7 changes: 7 additions & 0 deletions src/ViewModels/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -797,6 +803,7 @@ private bool RemoveInvalidRepositoriesRecursive(List<RepositoryNode> 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();

Expand Down
7 changes: 4 additions & 3 deletions src/Views/MergeConflictEditor.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
18 changes: 15 additions & 3 deletions src/Views/Preferences.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
<TabItem.Header>
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preferences.Appearance}"/>
</TabItem.Header>
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32,32,Auto" ColumnDefinitions="Auto,*">
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32,32,32,Auto" ColumnDefinitions="Auto,*">
<TextBlock Grid.Row="0" Grid.Column="0"
Text="{DynamicResource Text.Preferences.Appearance.Theme}"
HorizontalAlignment="Right"
Expand Down Expand Up @@ -270,6 +270,18 @@
Value="{Binding EditorTabWidth, Mode=TwoWay}"/>
</Grid>

<TextBlock Grid.Row="9" Grid.Column="0"
Text="{DynamicResource Text.Preferences.Appearance.MaxDiffLineLength}"
HorizontalAlignment="Right"
Margin="0,0,16,0"/>
<NumericUpDown Grid.Row="9" Grid.Column="1"
Minimum="0" Maximum="2147483647" Increment="100"
Height="28"
Padding="4"
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"
CornerRadius="3"
Value="{Binding MaxDiffLineLength, Mode=TwoWay}"/>

<TextBlock Grid.Row="5" Grid.Column="0"
Text="{DynamicResource Text.Preferences.Appearance.ThemeOverrides}"
HorizontalAlignment="Right"
Expand Down Expand Up @@ -897,7 +909,7 @@
<TextBox Margin="0,4,0,0" CornerRadius="3" Height="28" Text="{Binding Name, Mode=TwoWay}"/>

<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Preferences.AI.Server}"/>
<Grid ColumnDefinitions="*,Auto"
<Grid ColumnDefinitions="*,Auto"
Margin="0,4,0,0"
Height="28">
<TextBox Grid.Column="0"
Expand All @@ -918,7 +930,7 @@
<Path Width="12" Height="12"
Data="{StaticResource Icons.Plus}"
IsVisible="{Binding !HasValidApiKey, Mode=OneWay}"/>

<TextBlock Margin="6,0,0,0"
VerticalAlignment="Center"
Text="{DynamicResource Text.Preferences.AI.ApiKey}"/>
Expand Down
14 changes: 8 additions & 6 deletions src/Views/TextDiffView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down