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:
leo 2025-06-11 20:25:41 +08:00
parent a128b67bd4
commit f59851f454
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -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);
});
}
}

View file

@ -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
{