From 8d08f417dc1f5b2681774f000951993e0f0cf79f Mon Sep 17 00:00:00 2001
From: Kitty Barnett <develop@catznip.com>
Date: Sun, 23 Oct 2022 16:37:10 +0200
Subject: [PATCH] Show tooltip when hovering over an emoji text segment
 (currently will show its shortcode)

---
 indra/llui/lltextbase.cpp | 14 ++++++++++++++
 indra/llui/lltextbase.h   |  1 +
 2 files changed, 15 insertions(+)

diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 2a6e6901e43..693dcb7b8da 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -3557,6 +3557,20 @@ LLEmojiTextSegment::LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end
 {
 }
 
+BOOL LLEmojiTextSegment::handleToolTip(S32 x, S32 y, MASK mask)
+{
+	if (mTooltip.empty())
+	{
+		LLWString emoji = getWText().substr(getStart(), getEnd() - getStart());
+		if (!emoji.empty())
+		{
+			mTooltip = LLEmojiHelper::instance().getToolTip(emoji[0]);
+		}
+	}
+
+	return LLNormalTextSegment::handleToolTip(x, y, mask);
+}
+
 //
 // LLOnHoverChangeableTextSegment
 //
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index fc999c4cca1..31e9f161100 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -187,6 +187,7 @@ class LLEmojiTextSegment : public LLNormalTextSegment
 	LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE);
 
 	bool canEdit() const override { return false; }
+	BOOL handleToolTip(S32 x, S32 y, MASK mask);
 };
 
 // Text segment that changes it's style depending of mouse pointer position ( is it inside or outside segment)
-- 
GitLab