mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-20 18:05:00 +00:00
Add new Preferences checkbox: Use case-insensitive sorting in lists
This commit is contained in:
parent
913b5dd7fe
commit
e7a1492563
7 changed files with 38 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using SourceGit.ViewModels;
|
||||
|
||||
namespace SourceGit.Commands
|
||||
{
|
||||
|
@ -39,7 +40,8 @@ namespace SourceGit.Commands
|
|||
foreach (var line in lines)
|
||||
ParseLine(line);
|
||||
|
||||
_changes.Sort((l, r) => string.Compare(l.Path, r.Path, StringComparison.Ordinal));
|
||||
_changes.Sort((l, r) => string.Compare(l.Path, r.Path,
|
||||
Preferences.Instance.GetPreferredListComparisonType()));
|
||||
return _changes;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,8 @@ namespace SourceGit.Models
|
|||
if (l.Type != r.Type)
|
||||
return (int)l.Type - (int)r.Type;
|
||||
else
|
||||
return string.Compare(l.Name, r.Name, StringComparison.Ordinal);
|
||||
return string.Compare(l.Name, r.Name,
|
||||
ViewModels.Preferences.Instance.GetPreferredListComparisonType());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,8 @@ namespace SourceGit.Models
|
|||
}
|
||||
else
|
||||
{
|
||||
result = string.CompareOrdinal(sub1, sub2);
|
||||
result = string.Compare(sub1, sub2,
|
||||
ViewModels.Preferences.Instance.GetPreferredListComparisonType());
|
||||
}
|
||||
if (result != 0)
|
||||
return result;
|
||||
|
|
|
@ -491,6 +491,7 @@
|
|||
<x:String x:Key="Text.Preferences.Appearance.OnlyUseMonoFontInEditor" xml:space="preserve">Use monospace font only in text editor</x:String>
|
||||
<x:String x:Key="Text.Preferences.Appearance.Theme" xml:space="preserve">Theme</x:String>
|
||||
<x:String x:Key="Text.Preferences.Appearance.ThemeOverrides" xml:space="preserve">Theme Overrides</x:String>
|
||||
<x:String x:Key="Text.Preferences.Appearance.UseCaseInsensitiveSortingInLists" xml:space="preserve">Use case-insensitive sorting in lists</x:String>
|
||||
<x:String x:Key="Text.Preferences.Appearance.UseFixedTabWidth" xml:space="preserve">Use fixed tab width in titlebar</x:String>
|
||||
<x:String x:Key="Text.Preferences.Appearance.UseNativeWindowFrame" xml:space="preserve">Use native window frame</x:String>
|
||||
<x:String x:Key="Text.Preferences.DiffMerge" xml:space="preserve">DIFF/MERGE TOOL</x:String>
|
||||
|
|
|
@ -89,6 +89,20 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public bool UseCaseInsensitiveSortingInLists
|
||||
{
|
||||
get => _useCaseInsensitiveSortingInLists;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _useCaseInsensitiveSortingInLists, value) && !_isLoading)
|
||||
{
|
||||
var launcher = App.GetLauncher();
|
||||
if (launcher.ActivePage.Data is ViewModels.Repository repo)
|
||||
repo.RefreshAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool UseSystemWindowFrame
|
||||
{
|
||||
get => Native.OS.UseSystemWindowFrame;
|
||||
|
@ -432,6 +446,12 @@ namespace SourceGit.ViewModels
|
|||
return first;
|
||||
}
|
||||
|
||||
public StringComparison GetPreferredListComparisonType()
|
||||
{
|
||||
return Preferences.Instance.UseCaseInsensitiveSortingInLists ?
|
||||
StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
|
||||
}
|
||||
|
||||
public void AddNode(RepositoryNode node, RepositoryNode to, bool save)
|
||||
{
|
||||
var collection = to == null ? RepositoryNodes : to.SubNodes;
|
||||
|
@ -449,7 +469,7 @@ namespace SourceGit.ViewModels
|
|||
if (l.IsRepository != r.IsRepository)
|
||||
return l.IsRepository ? 1 : -1;
|
||||
|
||||
return string.Compare(l.Name, r.Name, StringComparison.Ordinal);
|
||||
return string.Compare(l.Name, r.Name, GetPreferredListComparisonType());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -669,6 +689,7 @@ namespace SourceGit.ViewModels
|
|||
private string _defaultFontFamily = string.Empty;
|
||||
private string _monospaceFontFamily = string.Empty;
|
||||
private bool _onlyUseMonoFontInEditor = true;
|
||||
private bool _useCaseInsensitiveSortingInLists = false;
|
||||
private double _defaultFontSize = 13;
|
||||
private double _editorFontSize = 13;
|
||||
private int _editorTabWidth = 4;
|
||||
|
|
|
@ -71,7 +71,8 @@ namespace SourceGit.ViewModels
|
|||
changes.Add(c);
|
||||
|
||||
if (needSort)
|
||||
changes.Sort((l, r) => string.Compare(l.Path, r.Path, StringComparison.Ordinal));
|
||||
changes.Sort((l, r) => string.Compare(l.Path, r.Path,
|
||||
Preferences.Instance.GetPreferredListComparisonType()));
|
||||
}
|
||||
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
|
|
|
@ -153,7 +153,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"
|
||||
|
@ -260,6 +260,11 @@
|
|||
IsChecked="{Binding UseFixedTabWidth, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="8" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.Appearance.UseCaseInsensitiveSortingInLists}"
|
||||
IsChecked="{Binding UseCaseInsensitiveSortingInLists, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="9" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.Appearance.UseNativeWindowFrame}"
|
||||
IsChecked="{Binding UseSystemWindowFrame, Mode=OneTime}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue