mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-10 08:51:12 +00:00
In emoji suggestions match only full strings.
This commit is contained in:
parent
f88466a376
commit
c7836be614
@ -72,6 +72,12 @@ struct LangPackData {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] EmojiPtr FindExact(const QString &text) {
|
||||||
|
auto length = 0;
|
||||||
|
const auto result = Find(text, &length);
|
||||||
|
return (length < text.size()) ? nullptr : result;
|
||||||
|
}
|
||||||
|
|
||||||
void CreateCacheFilePath() {
|
void CreateCacheFilePath() {
|
||||||
QDir().mkpath(internal::CacheFileFolder() + qstr("/keywords"));
|
QDir().mkpath(internal::CacheFileFolder() + qstr("/keywords"));
|
||||||
}
|
}
|
||||||
@ -120,7 +126,7 @@ void CreateCacheFilePath() {
|
|||||||
const auto emoji = MustAddPostfix(text)
|
const auto emoji = MustAddPostfix(text)
|
||||||
? (text + QChar(Ui::Emoji::kPostfix))
|
? (text + QChar(Ui::Emoji::kPostfix))
|
||||||
: text;
|
: text;
|
||||||
const auto entry = LangPackEmoji{ Find(emoji), text };
|
const auto entry = LangPackEmoji{ FindExact(emoji), text };
|
||||||
if (!entry.emoji) {
|
if (!entry.emoji) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -251,7 +257,7 @@ void ApplyDifference(
|
|||||||
const auto emoji = MustAddPostfix(text)
|
const auto emoji = MustAddPostfix(text)
|
||||||
? (text + QChar(Ui::Emoji::kPostfix))
|
? (text + QChar(Ui::Emoji::kPostfix))
|
||||||
: text;
|
: text;
|
||||||
return LangPackEmoji{ Find(emoji), text };
|
return LangPackEmoji{ FindExact(emoji), text };
|
||||||
}) | ranges::view::filter([&](const LangPackEmoji &entry) {
|
}) | ranges::view::filter([&](const LangPackEmoji &entry) {
|
||||||
if (!entry.emoji) {
|
if (!entry.emoji) {
|
||||||
LOG(("API Warning: emoji %1 is not supported, word: %2."
|
LOG(("API Warning: emoji %1 is not supported, word: %2."
|
||||||
|
Loading…
Reference in New Issue
Block a user