From 8fa463113c19682a64988d2f8c527ef5e5dd156c Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Tue, 17 Sep 2013 12:20:28 +0300 Subject: MAINT-3119 FIXED Select auto-completed part using cursor position --- indra/llui/lltexteditor.cpp | 8 ++++++++ indra/llui/lltexteditor.h | 2 ++ indra/newview/llfloaterimnearbychat.cpp | 4 ++-- 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)) { -- cgit v1.2.3