diff options
author | thickbrick | 2010-09-25 16:14:11 +0200 |
---|---|---|
committer | thickbrick | 2010-09-25 16:14:11 +0200 |
commit | 2760d30363716b8d469134d197a9874eccea6aa3 (patch) | |
tree | 60b9779497100e984d1b94d4946a1a99cb0161f6 /linden | |
parent | LLTextEditor context translator: (diff) | |
download | meta-impy-2760d30363716b8d469134d197a9874eccea6aa3.zip meta-impy-2760d30363716b8d469134d197a9874eccea6aa3.tar.gz meta-impy-2760d30363716b8d469134d197a9874eccea6aa3.tar.bz2 meta-impy-2760d30363716b8d469134d197a9874eccea6aa3.tar.xz |
LLTextEditor context translator: set selection after translation.
Diffstat (limited to 'linden')
-rw-r--r-- | linden/indra/llui/lltexteditor.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index adf0260..d59eed6 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp | |||
@@ -499,8 +499,9 @@ void LLTextEditor::translateText(void * data) | |||
499 | 499 | ||
500 | if (has_text) | 500 | if (has_text) |
501 | { | 501 | { |
502 | const std::string to_translate = wstring_to_utf8str(line->getWText().substr(start, length)); | ||
502 | LLHTTPClient::ResponderPtr result = TextChatTranslationReceiver::build(toLang, line, start, length); | 503 | LLHTTPClient::ResponderPtr result = TextChatTranslationReceiver::build(toLang, line, start, length); |
503 | LLTranslate::translateMessage(result,"", toLang, line->getText().substr(start, length)); | 504 | LLTranslate::translateMessage(result,"", toLang, to_translate); |
504 | } | 505 | } |
505 | } | 506 | } |
506 | 507 | ||
@@ -2290,8 +2291,13 @@ void LLTextEditor::translationReplace(const std::string &translation, const S32 | |||
2290 | { | 2291 | { |
2291 | remove(orig_start, orig_length, FALSE); | 2292 | remove(orig_start, orig_length, FALSE); |
2292 | } | 2293 | } |
2293 | insert(pos, wtext, FALSE); | 2294 | S32 inserted = insert(pos, wtext, FALSE); |
2294 | setCursorPos(pos + wtext.length()); | 2295 | if (hasSelection()) |
2296 | { | ||
2297 | mSelectionStart = llclamp(pos, 0, getLength()); | ||
2298 | mSelectionEnd = llclamp(pos + inserted, mSelectionStart, getLength()); | ||
2299 | } | ||
2300 | setCursorPos(pos + inserted); | ||
2295 | needsReflow(); | 2301 | needsReflow(); |
2296 | } | 2302 | } |
2297 | 2303 | ||