mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-21 13:20:30 +08:00
refactor: case-insensitive sorting
- `ToUpper` is not necessary to compare digit char with non-digit char - use numeric sorting for commit decorators with same type Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -113,7 +113,7 @@ 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 NumericSort.Compare(l.Name, r.Name);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace SourceGit.Models
|
||||
bool isDigit1 = char.IsDigit(c1);
|
||||
bool isDigit2 = char.IsDigit(c2);
|
||||
if (isDigit1 != isDigit2)
|
||||
return char.ToUpper(c1, CultureInfo.CurrentCulture).CompareTo(char.ToUpper(c2, CultureInfo.CurrentCulture));
|
||||
return c1.CompareTo(c2);
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user