summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llemojidictionary.cpp8
-rw-r--r--indra/llui/llemojidictionary.h4
-rw-r--r--indra/llui/llemojihelper.cpp3
3 files changed, 8 insertions, 7 deletions
diff --git a/indra/llui/llemojidictionary.cpp b/indra/llui/llemojidictionary.cpp
index c31638b0bf..b70a9b2e7a 100644
--- a/indra/llui/llemojidictionary.cpp
+++ b/indra/llui/llemojidictionary.cpp
@@ -178,22 +178,22 @@ LLWString LLEmojiDictionary::findMatchingEmojis(const std::string& needle) const
const LLEmojiDescriptor* LLEmojiDictionary::getDescriptorFromShortCode(const std::string& short_code) const
{
const auto it = mShortCode2Descr.find(short_code);
- return (mShortCode2Descr.end() != it) ? &it->second : nullptr;
+ return (mShortCode2Descr.end() != it) ? it->second : nullptr;
}
std::string LLEmojiDictionary::getNameFromEmoji(llwchar ch) const
{
const auto it = mEmoji2Descr.find(ch);
- return (mEmoji2Descr.end() != it) ? it->second.Name : LLStringUtil::null;
+ return (mEmoji2Descr.end() != it) ? it->second->Name : LLStringUtil::null;
}
void LLEmojiDictionary::addEmoji(LLEmojiDescriptor&& descr)
{
mEmojis.push_back(descr);
- mEmoji2Descr.insert(std::make_pair(descr.Character, mEmojis.back()));
+ mEmoji2Descr.insert(std::make_pair(descr.Character, &mEmojis.back()));
for (const std::string& shortCode : descr.ShortCodes)
{
- mShortCode2Descr.insert(std::make_pair(shortCode, mEmojis.back()));
+ mShortCode2Descr.insert(std::make_pair(shortCode, &mEmojis.back()));
}
}
diff --git a/indra/llui/llemojidictionary.h b/indra/llui/llemojidictionary.h
index 0cde663719..46a61f1cd7 100644
--- a/indra/llui/llemojidictionary.h
+++ b/indra/llui/llemojidictionary.h
@@ -66,8 +66,8 @@ private:
private:
std::list<LLEmojiDescriptor> mEmojis;
- std::map<llwchar, const LLEmojiDescriptor&> mEmoji2Descr;
- std::map<std::string, const LLEmojiDescriptor&> mShortCode2Descr;
+ std::map<llwchar, const LLEmojiDescriptor*> mEmoji2Descr;
+ std::map<std::string, const LLEmojiDescriptor*> mShortCode2Descr;
};
// ============================================================================
diff --git a/indra/llui/llemojihelper.cpp b/indra/llui/llemojihelper.cpp
index 32471e59a8..1e4c19a183 100644
--- a/indra/llui/llemojihelper.cpp
+++ b/indra/llui/llemojihelper.cpp
@@ -57,7 +57,8 @@ bool LLEmojiHelper::isActive(const LLUICtrl* ctrl_p) const
// static
bool LLEmojiHelper::isCursorInEmojiCode(const LLWString& wtext, S32 cursorPos, S32* pShortCodePos)
{
- S32 shortCodePos = cursorPos;
+ // If the cursor is currently on a colon start the check one character further back
+ S32 shortCodePos = (cursorPos == 0 || L':' != wtext[cursorPos - 1]) ? cursorPos : cursorPos - 1;
auto isPartOfShortcode = [](llwchar ch) {
switch (ch)