Sort fonts alphabetically (#9653)

Validated this only by following the issue description and verified fonts appeared to be sorted alphabetically now.

Closes #9594
This commit is contained in:
kovdu 2021-03-30 00:36:28 +02:00 committed by GitHub
parent 3323dc5724
commit cf5dc285a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -153,10 +153,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
// sort and save the lists
std::sort(begin(fontList), end(fontList));
std::sort(begin(fontList), end(fontList), FontComparator());
_FontList = single_threaded_observable_vector<Editor::Font>(std::move(fontList));
std::sort(begin(monospaceFontList), end(monospaceFontList));
std::sort(begin(monospaceFontList), end(monospaceFontList), FontComparator());
_MonospaceFontList = single_threaded_observable_vector<Editor::Font>(std::move(monospaceFontList));
}
CATCH_LOG();

View file

@ -13,6 +13,14 @@
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct FontComparator
{
bool operator()(const Font& lhs, const Font& rhs) const
{
return lhs.LocalizedName() < rhs.LocalizedName();
}
};
struct Font : FontT<Font>
{
public: