aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui
diff options
context:
space:
mode:
authorthickbrick2010-09-25 01:14:51 +0200
committerthickbrick2010-09-25 13:34:05 +0200
commit6cd906519bf090dff532b3cf4d206fd1a25c6504 (patch)
treedc03d50c91c4c06e464974cba142070ef8bf0e28 /linden/indra/llui
parentFix LLLineEditor context menu translator returning "()" when nothing is selec... (diff)
downloadmeta-impy-6cd906519bf090dff532b3cf4d206fd1a25c6504.zip
meta-impy-6cd906519bf090dff532b3cf4d206fd1a25c6504.tar.gz
meta-impy-6cd906519bf090dff532b3cf4d206fd1a25c6504.tar.bz2
meta-impy-6cd906519bf090dff532b3cf4d206fd1a25c6504.tar.xz
More LLLineEditor context translator bugfixes:
- Use LLWString when doing size calculations (potential crashes and misplaced text) - Weird selection range after translating selected text.
Diffstat (limited to 'linden/indra/llui')
-rw-r--r--linden/indra/llui/lllineeditor.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp
index 27a1d50..5f2a314 100644
--- a/linden/indra/llui/lllineeditor.cpp
+++ b/linden/indra/llui/lllineeditor.cpp
@@ -567,8 +567,9 @@ void LLLineEditor::translateText(void * data)
567 567
568 if (has_text) 568 if (has_text)
569 { 569 {
570 std::string to_translate = wstring_to_utf8str(line->getWText().substr(start, length));
570 LLHTTPClient::ResponderPtr result = LineChatTranslationReceiver::build(toLang, line, start, length); 571 LLHTTPClient::ResponderPtr result = LineChatTranslationReceiver::build(toLang, line, start, length);
571 LLTranslate::translateMessage(result,"", toLang, line->getText().substr(start, length)); 572 LLTranslate::translateMessage(result,"", toLang, to_translate);
572 } 573 }
573} 574}
574 575
@@ -1133,13 +1134,11 @@ void LLLineEditor::setSelection(S32 start, S32 end)
1133{ 1134{
1134 S32 len = mText.length(); 1135 S32 len = mText.length();
1135 1136
1136 mIsSelecting = TRUE;
1137
1138 // JC, yes, this seems odd, but I think you have to presume a 1137 // JC, yes, this seems odd, but I think you have to presume a
1139 // selection dragged from the end towards the start. 1138 // selection dragged from the end towards the start.
1140 mSelectionStart = llclamp(end, 0, len); 1139 mSelectionStart = llclamp(end, 0, len);
1141 mSelectionEnd = llclamp(start, 0, len); 1140 mSelectionEnd = llclamp(start, 0, len);
1142 setCursor(start); 1141 setCursor(end);
1143} 1142}
1144 1143
1145void LLLineEditor::setDrawAsterixes(BOOL b) 1144void LLLineEditor::setDrawAsterixes(BOOL b)
@@ -1187,7 +1186,7 @@ BOOL LLLineEditor::getWordBoundriesAt(const S32 at, S32* word_begin, S32* word_l
1187 pos--; 1186 pos--;
1188 } 1187 }
1189 *word_begin = pos; 1188 *word_begin = pos;
1190 while ( (pos < getLength()) && LLTextEditor::isPartOfWord(wtext[pos]) ) 1189 while ( (pos < wtext.length()) && LLTextEditor::isPartOfWord(wtext[pos]) )
1191 { 1190 {
1192 pos++; 1191 pos++;
1193 } 1192 }
@@ -1373,12 +1372,12 @@ void LLLineEditor::translationReplace(const std::string &translation, const S32
1373 } 1372 }
1374 insert(text, pos); 1373 insert(text, pos);
1375 1374
1375 S32 text_wlen = utf8str_to_wstring(text).length();
1376 if (hasSelection()) 1376 if (hasSelection())
1377 { 1377 {
1378 mSelectionStart = pos; 1378 setSelection(pos, pos + text_wlen);
1379 mSelectionEnd = pos + text.length();
1380 } 1379 }
1381 setCursor(pos + text.length()); 1380 setCursor(pos + text_wlen);
1382} 1381}
1383 1382
1384void LLLineEditor::insert(std::string what, S32 wher) 1383void LLLineEditor::insert(std::string what, S32 wher)