summaryrefslogtreecommitdiff
path: root/indra/llui/lltexteditor.cpp
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@lindenlab.com>2025-08-29 12:48:44 -0400
committerGitHub <noreply@github.com>2025-08-29 12:48:44 -0400
commit842ac1e1503e41662c924289905b43b336b52a53 (patch)
treed8067fc99f6c699e3d15510c8521a32102f5cb30 /indra/llui/lltexteditor.cpp
parent28678996ceaea019aafaa26911a440769320c498 (diff)
parent787b63f4c29f6ef56f355ec80084458a1bbcfb35 (diff)
Merge pull request #4379 from secondlife/release/2025.06
Release/2025.06
Diffstat (limited to 'indra/llui/lltexteditor.cpp')
-rw-r--r--indra/llui/lltexteditor.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index cfe729be06..58b785fcdd 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -274,7 +274,9 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mShowChatMentionPicker(false),
mEnableTooltipPaste(p.enable_tooltip_paste),
mPassDelete(false),
- mKeepSelectionOnReturn(false)
+ mKeepSelectionOnReturn(false),
+ mSelectAllOnFocusReceived(false),
+ mSelectedOnFocusReceived(false)
{
mSourceID.generate();
@@ -398,6 +400,7 @@ void LLTextEditor::selectNext(const std::string& search_text_in, bool case_insen
setCursorPos(loc);
mIsSelecting = true;
+ mSelectedOnFocusReceived = false;
mSelectionEnd = mCursorPos;
mSelectionStart = llmin((S32)getLength(), (S32)(mCursorPos + search_text.size()));
}
@@ -677,6 +680,13 @@ bool LLTextEditor::canSelectAll() const
return true;
}
+//virtual
+void LLTextEditor::deselect()
+{
+ LLTextBase::deselect();
+ mSelectedOnFocusReceived = false;
+}
+
// virtual
void LLTextEditor::selectAll()
{
@@ -694,6 +704,11 @@ void LLTextEditor::selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_p
endSelection();
}
+void LLTextEditor::setSelectAllOnFocusReceived(bool b)
+{
+ mSelectAllOnFocusReceived = b;
+}
+
void LLTextEditor::insertEmoji(llwchar emoji)
{
LL_INFOS() << "LLTextEditor::insertEmoji(" << wchar_utf8_preview(emoji) << ")" << LL_ENDL;
@@ -795,8 +810,16 @@ bool LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
// Delay cursor flashing
resetCursorBlink();
+ mSelectedOnFocusReceived = false;
if (handled && !gFocusMgr.getMouseCapture())
{
+ if (!mask && mSelectAllOnFocusReceived)
+ {
+ mIsSelecting = false;
+ mSelectionStart = getLength();
+ mSelectionEnd = 0;
+ mSelectedOnFocusReceived = true;
+ }
gFocusMgr.setMouseCapture( this );
}
return handled;
@@ -2200,6 +2223,11 @@ void LLTextEditor::focusLostHelper()
gEditMenuHandler = NULL;
}
+ if (mSelectedOnFocusReceived)
+ {
+ deselect();
+ }
+
if (mCommitOnFocusLost)
{
onCommit();