From f36f50462e226308424d57298aa29c4dccfef6e2 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Mon, 2 Oct 2023 14:08:31 +0200 Subject: SL-20387 Show Emoji Completion floater at the beginning of the shortcode --- indra/llui/lltexteditor.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/llui/lltexteditor.cpp') 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); } } -- cgit v1.2.3