summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorAlexander Gavriliuk <alexandrgproductengine@lindenlab.com>2023-10-02 14:08:31 +0200
committerGuru <alexandrgproductengine@lindenlab.com>2023-10-02 14:38:11 +0200
commitf36f50462e226308424d57298aa29c4dccfef6e2 (patch)
tree8f2f7f95b9fb1a626c328f37d3c4d532aa04f6f2 /indra/llui
parent317041be0dca02cf0667abad472db51fd7e69ded (diff)
SL-20387 Show Emoji Completion floater at the beginning of the shortcode
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llemojihelper.cpp3
-rw-r--r--indra/llui/lltexteditor.cpp11
2 files changed, 9 insertions, 5 deletions
diff --git a/indra/llui/llemojihelper.cpp b/indra/llui/llemojihelper.cpp
index fb660a9e5b..1d7744cb55 100644
--- a/indra/llui/llemojihelper.cpp
+++ b/indra/llui/llemojihelper.cpp
@@ -37,7 +37,7 @@
//
constexpr char DEFAULT_EMOJI_HELPER_FLOATER[] = "emoji_complete";
-constexpr S32 HELPER_FLOATER_OFFSET_X = 20;
+constexpr S32 HELPER_FLOATER_OFFSET_X = 0;
constexpr S32 HELPER_FLOATER_OFFSET_Y = 0;
// ============================================================================
@@ -113,6 +113,7 @@ void LLEmojiHelper::showHelper(LLUICtrl* hostctrl_p, S32 local_x, S32 local_y, c
rct.setLeftTopAndSize(floater_x - HELPER_FLOATER_OFFSET_X, floater_y - HELPER_FLOATER_OFFSET_Y + rct.getHeight(), rct.getWidth(), rct.getHeight());
pHelperFloater->setRect(rct);
pHelperFloater->openFloater(LLSD().with("hint", short_code));
+ gFloaterView->adjustToFitScreen(pHelperFloater, FALSE);
}
void LLEmojiHelper::hideHelper(const LLUICtrl* ctrl_p)
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);
}
}