summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbox.cpp
diff options
context:
space:
mode:
authorMartin Reddy <lynx@lindenlab.com>2009-09-24 10:41:08 +0000
committerMartin Reddy <lynx@lindenlab.com>2009-09-24 10:41:08 +0000
commit7b2737e0e14f815e69da7114dda693cdaea2c341 (patch)
tree0c2a1941ea55fc56b35faae47d55cae36578960b /indra/llui/lltextbox.cpp
parentf5b66f353e0a958a1fa4b17a40d4014ba4f046c9 (diff)
EXT-944 EXT-1026: cleaning up my quick fix for these issues.
I've now added an explicit LLUrlRegistry::findUrl() method for LLWStrings. This deals with correcting the start/end range for the url appropriately. Now the API can be used without worrying about utf8/utf32 character offset issues. Internal JIRAs: DEV-40127 DEV-39966.
Diffstat (limited to 'indra/llui/lltextbox.cpp')
-rw-r--r--indra/llui/lltextbox.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index d6ae9e063e..132bef0296 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -302,11 +302,10 @@ LLWString LLTextBox::getWrappedText(const LLStringExplicit& in_text, F32 max_wid
// find the next Url in the text string
LLUrlMatch match;
- while ( LLUrlRegistry::instance().findUrl(wstring_to_utf8str(wtext), match))
+ while ( LLUrlRegistry::instance().findUrl(wtext, match))
{
- LLWString wurl = utf8str_to_wstring(match.getUrl());
- S32 start = wtext.find(wurl);
- S32 end = start + wurl.size();
+ S32 start = match.getStart();
+ S32 end = match.getEnd() + 1;
// perform word wrap on the text before the Url
final_wtext += wrapText(wtext.substr(0, start), hoffset, line_num, max_width);
@@ -579,14 +578,14 @@ void LLTextBox::updateDisplayTextAndSegments()
LLWString text = mText.getWString();
// find the next Url in the text string
- while ( LLUrlRegistry::instance().findUrl(wstring_to_utf8str(text), match,
+ while ( LLUrlRegistry::instance().findUrl(text, match,
boost::bind(&LLTextBox::onUrlLabelUpdated, this, _1, _2)) )
{
// work out the char offset for the start/end of the url
- LLWString wurl = utf8str_to_wstring(match.getUrl());
- S32 url_start = text.find(wurl);
- S32 url_end = url_start + wurl.size() - 1;
+ S32 url_start = match.getStart();
+ S32 url_end = match.getEnd();
+ // and the char offset for the label in the display text
S32 seg_start = mDisplayText.size();
S32 start = seg_start + url_start;
S32 end = start + match.getLabel().size();