diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-10-02 14:08:31 +0200 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2023-10-02 14:38:11 +0200 |
commit | f36f50462e226308424d57298aa29c4dccfef6e2 (patch) | |
tree | 8f2f7f95b9fb1a626c328f37d3c4d532aa04f6f2 /indra/llui/lltexteditor.cpp | |
parent | 317041be0dca02cf0667abad472db51fd7e69ded (diff) |
SL-20387 Show Emoji Completion floater at the beginning of the shortcode
Diffstat (limited to 'indra/llui/lltexteditor.cpp')
-rw-r--r-- | indra/llui/lltexteditor.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 95d8b666ab..4467496146 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1169,12 +1169,15 @@ void LLTextEditor::addChar(llwchar wc) if (!mReadOnly && mShowEmojiHelper) { - LLWString wtext(getWText()); S32 shortCodePos; + S32 shortCodePos; + LLWString wtext(getWText()); if (LLEmojiHelper::isCursorInEmojiCode(wtext, mCursorPos, &shortCodePos)) { - const LLRect cursorRect = getLocalRectFromDocIndex(mCursorPos - 1); - const LLWString shortCode = wtext.substr(shortCodePos, mCursorPos - shortCodePos); - LLEmojiHelper::instance().showHelper(this, cursorRect.mLeft, cursorRect.mTop, wstring_to_utf8str(shortCode), std::bind(&LLTextEditor::handleEmojiCommit, this, std::placeholders::_1)); + const LLRect cursorRect(getLocalRectFromDocIndex(shortCodePos)); + const LLWString wpart(wtext.substr(shortCodePos, mCursorPos - shortCodePos)); + const std::string part(wstring_to_utf8str(wpart)); + auto cb = [this](llwchar emoji) { handleEmojiCommit(emoji); }; + LLEmojiHelper::instance().showHelper(this, cursorRect.mLeft, cursorRect.mTop, part, cb); } } |