Skip to content

Commit

Permalink
Fix missing icons after sorting in iconselect
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed May 16, 2024
1 parent 7cc9014 commit 9dd9eda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/widgets/emojiregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const EmojiRegistry &EmojiRegistry::instance()
bool EmojiRegistry::isEmoji(const QString &code) const
{
auto cat = startCategory(code);
return cat == Category::Emoji || cat == Category::SkinTone;
return cat == Category::Emoji || cat == Category::SkinTone || cat == Category::HairStyle;
// TODO check the whole code is emoji. not just start
}

Expand Down Expand Up @@ -120,7 +120,7 @@ std::pair<QStringView, int> EmojiRegistry::findEmoji(const QString &in, int idx)
} else
break; // TODO review other categories when implemented
} else if (!gotEmoji
&& (category == Category::Emoji || category == Category::SkinTone
&& (category == Category::Emoji || category == Category::SkinTone || category == Category::HairStyle
|| category == Category::SimpleKeycap)) {
if (emojiStart == -1)
emojiStart = idx;
Expand Down
5 changes: 4 additions & 1 deletion src/widgets/iconselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,18 @@ QList<PsiIcon *> IconSelect::sortEmojis() const
for (auto const &group : EmojiRegistry::instance().groups) {
for (auto const &subgroup : group.subGroups) {
for (auto const &emoji : subgroup.emojis) {
auto icon = cp2icon.value(emoji.code);
auto icon = cp2icon.take(emoji.code);
if (icon) {
ret.append(icon);
}
}
}
}

auto unused = cp2icon.values();
auto unique = QSet<PsiIcon *>(unused.begin(), unused.end());
ret += notEmoji;
std::copy(unique.begin(), unique.end(), std::back_inserter(ret));
return ret;
}

Expand Down

0 comments on commit 9dd9eda

Please sign in to comment.