summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMnikolenko ProductEngine <mnikolenko@productengine.com>2013-09-17 12:20:28 +0300
committerMnikolenko ProductEngine <mnikolenko@productengine.com>2013-09-17 12:20:28 +0300
commit8fa463113c19682a64988d2f8c527ef5e5dd156c (patch)
tree67dd68e257ebc8c4ea475265bacebbfb13d8b91f
parentea9af8b873c9c088ff640a556f14f3a5989f9547 (diff)
MAINT-3119 FIXED Select auto-completed part using cursor position
-rwxr-xr-xindra/llui/lltexteditor.cpp8
-rwxr-xr-xindra/llui/lltexteditor.h2
-rwxr-xr-xindra/newview/llfloaterimnearbychat.cpp4
3 files changed, 12 insertions, 2 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 0c16e06109..764f0b8b36 100755
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -666,6 +666,14 @@ void LLTextEditor::selectAll()
updatePrimary();
}
+void LLTextEditor::selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_pos)
+{
+ setCursorPos(prev_cursor_pos);
+ startSelection();
+ setCursorPos(next_cursor_pos);
+ endSelection();
+}
+
BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = FALSE;
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 32b543ec0e..d3b7bc0eb7 100755
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -144,6 +144,8 @@ public:
virtual void selectAll();
virtual BOOL canSelectAll() const;
+ void selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_pos);
+
virtual bool canLoadOrSaveToFile();
void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE);
diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index 86e64c25e3..323e84751f 100755
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -494,11 +494,11 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke()
if (!rest_of_match.empty())
{
mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
-
// Select to end of line, starting from the character
// after the last one the user typed.
- mInputEditor->selectNext(rest_of_match, false);
+ mInputEditor->selectByCursorPosition(utf8_out_str.size()-rest_of_match.size(),utf8_out_str.size());
}
+
}
else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str))
{