enhance: only show two chars when they are all ascii letters or digits (#585)

This commit is contained in:
leo 2024-10-21 16:58:15 +08:00
parent a5e783da08
commit 3296f90feb
No known key found for this signature in database

View file

@ -128,10 +128,9 @@ namespace SourceGit.Views
foreach (var part in parts)
chars.Add(part[0]);
if (chars.Count >= 2)
if (chars.Count >= 2 && char.IsAsciiLetterOrDigit(chars[0]) && char.IsAsciiLetterOrDigit(chars[^1]))
return string.Format("{0}{1}", chars[0], chars[^1]);
if (chars.Count == 1)
return string.Format("{0}", chars[0]);
return name.Substring(0, 1);
}