diff --git a/src/Commands/CompareRevisions.cs b/src/Commands/CompareRevisions.cs
index 7b4a496d..fe7430bc 100644
--- a/src/Commands/CompareRevisions.cs
+++ b/src/Commands/CompareRevisions.cs
@@ -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;
}
diff --git a/src/Models/Commit.cs b/src/Models/Commit.cs
index ced7597e..79c346bf 100644
--- a/src/Models/Commit.cs
+++ b/src/Models/Commit.cs
@@ -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());
});
}
}
diff --git a/src/Models/NumericSort.cs b/src/Models/NumericSort.cs
index 98e3d5c1..8ba48557 100644
--- a/src/Models/NumericSort.cs
+++ b/src/Models/NumericSort.cs
@@ -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;
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index afdff5da..d534fbf4 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -491,6 +491,7 @@
Use monospace font only in text editor
Theme
Theme Overrides
+ Use case-insensitive sorting in lists
Use fixed tab width in titlebar
Use native window frame
DIFF/MERGE TOOL
diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs
index e41e046e..84172343 100644
--- a/src/ViewModels/Preferences.cs
+++ b/src/ViewModels/Preferences.cs
@@ -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;
diff --git a/src/ViewModels/StashesPage.cs b/src/ViewModels/StashesPage.cs
index dec8ea6b..99bcce09 100644
--- a/src/ViewModels/StashesPage.cs
+++ b/src/ViewModels/StashesPage.cs
@@ -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(() =>
diff --git a/src/Views/Preferences.axaml b/src/Views/Preferences.axaml
index beb228b6..45b6253d 100644
--- a/src/Views/Preferences.axaml
+++ b/src/Views/Preferences.axaml
@@ -153,7 +153,7 @@
-
+
+
+