From 939214ef683957b66c4461bb7c8cf2fed345dffc Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 13 Mar 2015 21:28:50 +0100 Subject: [PATCH] FIRE-15712: Using Unicode characters in chat bar selects wrong part of the string when using nearby avatar name prediction --- indra/newview/fsfloaternearbychat.cpp | 2 +- indra/newview/fsnearbychatcontrol.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index 7c8e2bf623..b7ad9d931d 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -923,7 +923,7 @@ void FSFloaterNearbyChat::onChatBoxKeystroke() if (!rest_of_match.empty()) { mInputEditor->setText(prefix + replaced_text + suffix); - mInputEditor->selectByCursorPosition(prefix.size() + match.size(), prefix.size() + replaced_text.size()); + mInputEditor->selectByCursorPosition(utf8string_to_wstring(prefix).size() + utf8string_to_wstring(match).size(), utf8string_to_wstring(prefix).size() + utf8string_to_wstring(replaced_text).size()); } } } diff --git a/indra/newview/fsnearbychatcontrol.cpp b/indra/newview/fsnearbychatcontrol.cpp index 56c4602d09..64af8f94b2 100644 --- a/indra/newview/fsnearbychatcontrol.cpp +++ b/indra/newview/fsnearbychatcontrol.cpp @@ -277,7 +277,7 @@ void FSNearbyChatControl::onKeystroke(LLLineEditor* caller,void* userdata) prefix += match + rest_of_match + " "; } caller->setText(prefix + suffix); - caller->setSelection(prefix.length(), cur_pos); + caller->setSelection(utf8str_to_wstring(prefix).length(), cur_pos); } } }