summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbase.cpp
diff options
context:
space:
mode:
authorYuri Chebotarev <ychebotarev@productengine.com>2010-06-18 10:49:09 +0300
committerYuri Chebotarev <ychebotarev@productengine.com>2010-06-18 10:49:09 +0300
commitf26eb91c4467211d14c59b89c36d234949c28021 (patch)
tree06ba3cd1bf462daab4419b4ad311b8d914d7dde8 /indra/llui/lltextbase.cpp
parent884e08b5093453eeb8697ab2bdb242b4b3ab9135 (diff)
EXT-7766 FIX change the order of processing url matching and linebreaks
reviewed by Richard Nelson at https://codereview.productengine.com/secondlife/r/596/ --HG-- branch : product-engine
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r--indra/llui/lltextbase.cpp33
1 files changed, 7 insertions, 26 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 826ac3b940..2d0d5c12cb 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1616,7 +1616,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
part = (S32)LLTextParser::MIDDLE;
}
std::string subtext=text.substr(0,start);
- appendAndHighlightTextImpl(subtext, part, style_params);
+ appendAndHighlightText(subtext, part, style_params);
}
// output an optional icon before the Url
@@ -1637,11 +1637,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
// output the styled Url (unless we've been asked to suppress hyperlinking)
if (match.isLinkDisabled())
{
- appendAndHighlightTextImpl(match.getLabel(), part, style_params);
+ appendAndHighlightText(match.getLabel(), part, style_params);
}
else
{
- appendAndHighlightTextImpl(match.getLabel(), part, link_params);
+ appendAndHighlightText(match.getLabel(), part, link_params);
// set the tooltip for the Url label
if (! match.getTooltip().empty())
@@ -1669,11 +1669,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
if (part != (S32)LLTextParser::WHOLE)
part=(S32)LLTextParser::END;
if (end < (S32)text.length())
- appendAndHighlightTextImpl(text, part, style_params);
+ appendAndHighlightText(text, part, style_params);
}
else
{
- appendAndHighlightTextImpl(new_text, part, style_params);
+ appendAndHighlightText(new_text, part, style_params);
}
}
@@ -1684,23 +1684,7 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c
if(prepend_newline)
appendLineBreakSegment(input_params);
- std::string::size_type start = 0;
- std::string::size_type pos = new_text.find("\n",start);
-
- while(pos!=-1)
- {
- if(pos!=start)
- {
- std::string str = std::string(new_text,start,pos-start);
- appendTextImpl(str,input_params);
- }
- appendLineBreakSegment(input_params);
- start = pos+1;
- pos = new_text.find("\n",start);
- }
-
- std::string str = std::string(new_text,start,new_text.length()-start);
- appendTextImpl(str,input_params);
+ appendTextImpl(new_text,input_params);
}
void LLTextBase::needsReflow(S32 index)
@@ -1803,13 +1787,10 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig
}
}
-void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& style_params)
+void LLTextBase::appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params)
{
if (new_text.empty()) return;
- if(prepend_newline)
- appendLineBreakSegment(style_params);
-
std::string::size_type start = 0;
std::string::size_type pos = new_text.find("\n",start);