From 3e4502cbfa5b9b1b749ea52ca0168f90ee7a5e98 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Wed, 3 Jun 2026 00:32:13 +0300 Subject: #3342 Fix "Cut" and "Copy" options for objects in notecards --- indra/llui/lltextbase.h | 1 + indra/llui/lltexteditor.h | 2 +- indra/newview/llviewertexteditor.cpp | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index bc39d9732c..62f984b8fc 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -327,6 +327,7 @@ class LLTextBase public: friend class LLTextSegment; friend class LLNormalTextSegment; + friend class LLEmbeddedItemSegment; friend class LLUICtrlFactory; typedef boost::signals2::signal is_friend_signal_t; diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index d9742db34d..43f47a404c 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -208,6 +208,7 @@ public: void setShowContextMenu(bool show) { mShowContextMenu = show; } bool getShowContextMenu() const { return mShowContextMenu; } + void showContextMenu(S32 x, S32 y); void showEmojiHelper(); void hideEmojiHelper(); @@ -219,7 +220,6 @@ public: LLWString getConvertedText() const; protected: - void showContextMenu(S32 x, S32 y); void drawPreeditMarker(); void removeCharOrTab(); diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 95e34b4df1..a58d7546ce 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -249,6 +249,25 @@ public: /*virtual*/ bool canEdit() const { return false; } + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) + { + bool show_menu = !mEditor.hasSelection() + || (mEditor.mSelectionStart == mStart && mEditor.mSelectionEnd == mStart + 1); + if (show_menu && mEditor.getShowContextMenu()) + { + // User clicked an item, user expects the menu to be + // in 'context' for the item. Change selection to match. + // Todo: Might be better to 'smartly' deselect here + // and to have an object specific menu. + mEditor.setCursorPos(mStart + 1); + mEditor.mSelectionStart = mStart; + mEditor.mSelectionEnd = mStart + 1; + + mEditor.showContextMenu(x, y); + return true; + } + return false; + } /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) { -- cgit v1.3