mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-16 16:05:00 +00: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:
parent
a128b67bd4
commit
f59851f454
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue