summaryrefslogtreecommitdiff
path: root/indra/llui/lltexteditor.cpp
diff options
context:
space:
mode:
authorMartin Reddy <lynx@lindenlab.com>2009-09-22 18:00:16 +0000
committerMartin Reddy <lynx@lindenlab.com>2009-09-22 18:00:16 +0000
commit12762053e5aff372a9f8d473c71aa81e805bb474 (patch)
treec2c29e3b178cc9c51b99bd94d2f478e96d8a7d30 /indra/llui/lltexteditor.cpp
parentbe41bf82c6325fc45c7c6474645f384479e27091 (diff)
EXT-944 EXT-1026: converted the LLUrlRegistry::findUrl() method to
work on an LLWString instead of a std::string, so that we don't have to worry about character offsets for variable-length-encoded UTF-8 strings. This was causing crashes whenever we would try to show a textbox with a URL and foreign characters (> 1 byte chars). Damn, I suck!
Diffstat (limited to 'indra/llui/lltexteditor.cpp')
-rw-r--r--indra/llui/lltexteditor.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 983777b747..f7680a0a2b 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -3525,7 +3525,7 @@ void LLTextEditor::appendStyledText(const std::string &new_text,
S32 start=0,end=0;
LLUrlMatch match;
- std::string text = new_text;
+ LLWString text = utf8str_to_wstring(new_text);
while ( LLUrlRegistry::instance().findUrl(text, match,
boost::bind(&LLTextEditor::onUrlLabelUpdated, this, _1, _2)) )
{
@@ -3549,8 +3549,8 @@ void LLTextEditor::appendStyledText(const std::string &new_text,
{
part = (S32)LLTextParser::MIDDLE;
}
- std::string subtext=text.substr(0,start);
- appendHighlightedText(subtext,allow_undo, prepend_newline, part, style_params);
+ std::string subtext = wstring_to_utf8str(text.substr(0,start));
+ appendHighlightedText(subtext, allow_undo, prepend_newline, part, style_params);
prepend_newline = false;
}
@@ -3595,7 +3595,8 @@ void LLTextEditor::appendStyledText(const std::string &new_text,
}
}
if (part != (S32)LLTextParser::WHOLE) part=(S32)LLTextParser::END;
- if (end < (S32)text.length()) appendHighlightedText(text,allow_undo, prepend_newline, part, style_params);
+ if (end < (S32)text.length()) appendHighlightedText(wstring_to_utf8str(text), allow_undo,
+ prepend_newline, part, style_params);
}
else
{
@@ -4137,7 +4138,7 @@ void LLTextEditor::updateLinkSegments()
LLUrlMatch match;
LLStyleSP style = static_cast<LLStyleSP>(segment->getStyle());
std::string url_label = getText().substr(segment->getStart(), segment->getEnd()-segment->getStart());
- if (LLUrlRegistry::instance().findUrl(url_label, match))
+ if (LLUrlRegistry::instance().findUrl(utf8str_to_wstring(url_label), match))
{
LLStringUtil::trim(url_label);
style->setLinkHREF(url_label);