diff --git a/ui/text/text_entity.cpp b/ui/text/text_entity.cpp index 5adfe7c..383b3d0 100644 --- a/ui/text/text_entity.cpp +++ b/ui/text/text_entity.cpp @@ -2111,14 +2111,11 @@ EntitiesInText ConvertTextTagsToEntities(const TextWithTags::Tags &tags) { closeType(type); } } - if (linkChanged && !nextState.link.isEmpty()) { - if (Ui::InputField::IsCustomEmojiLink(nextState.link)) { - const auto data = Ui::InputField::CustomEmojiEntityData( - nextState.link); - if (!data.isEmpty()) { - openType(EntityType::CustomEmoji, data); - } - } else if (IsMentionLink(nextState.link)) { + const auto openLink = linkChanged && !nextState.link.isEmpty(); + const auto openCustomEmoji = openLink + && Ui::InputField::IsCustomEmojiLink(nextState.link); + if (openLink && !openCustomEmoji) { + if (IsMentionLink(nextState.link)) { const auto data = MentionEntityData(nextState.link); if (!data.isEmpty()) { openType(EntityType::MentionName, data); @@ -2132,6 +2129,13 @@ EntitiesInText ConvertTextTagsToEntities(const TextWithTags::Tags &tags) { openType(type, nextState.language); } } + if (openCustomEmoji) { + const auto data = Ui::InputField::CustomEmojiEntityData( + nextState.link); + if (!data.isEmpty()) { + openType(EntityType::CustomEmoji, data); + } + } state = nextState; }; const auto stateForTag = [&](const QString &tag) {