mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Bring chosen font to the top of the box.
This commit is contained in:
parent
b5f5aed119
commit
1f31d8032f
1 changed files with 12 additions and 2 deletions
|
@ -546,15 +546,25 @@ std::vector<Selector::Entry> Selector::FullList(const QString &now) {
|
|||
result.push_back({ .id = family });
|
||||
}
|
||||
}
|
||||
if (!ranges::contains(result, now, &Entry::id)) {
|
||||
auto nowIt = ranges::find(result, now, &Entry::id);
|
||||
if (nowIt == end(result)) {
|
||||
result.push_back({ .id = now });
|
||||
nowIt = end(result) - 1;
|
||||
}
|
||||
for (auto i = begin(result) + 2; i != end(result); ++i) {
|
||||
i->key = TextUtilities::RemoveAccents(i->id).toLower();
|
||||
i->text = i->id;
|
||||
i->keywords = TextUtilities::PrepareSearchWords(i->id);
|
||||
}
|
||||
ranges::sort(begin(result) + 2, end(result), std::less<>(), &Entry::key);
|
||||
auto skip = 2;
|
||||
if (nowIt - begin(result) >= skip) {
|
||||
std::swap(result[2], *nowIt);
|
||||
++skip;
|
||||
}
|
||||
ranges::sort(
|
||||
begin(result) + skip, end(result),
|
||||
std::less<>(),
|
||||
&Entry::key);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue