diff options
author | Yuri Chebotarev <ychebotarev@productengine.com> | 2010-06-18 10:49:09 +0300 |
---|---|---|
committer | Yuri Chebotarev <ychebotarev@productengine.com> | 2010-06-18 10:49:09 +0300 |
commit | f26eb91c4467211d14c59b89c36d234949c28021 (patch) | |
tree | 06ba3cd1bf462daab4419b4ad311b8d914d7dde8 /indra | |
parent | 884e08b5093453eeb8697ab2bdb242b4b3ab9135 (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')
-rw-r--r-- | indra/llui/lltextbase.cpp | 33 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 2 |
2 files changed, 8 insertions, 27 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); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 0a1b7f9ec1..92876e20d6 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -278,7 +278,7 @@ protected: S32 insertStringNoUndo(S32 pos, const LLWString &wstr, segment_vec_t* segments = NULL); // returns num of chars actually inserted S32 removeStringNoUndo(S32 pos, S32 length); S32 overwriteCharNoUndo(S32 pos, llwchar wc); - void appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& stylep); + void appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& stylep); // manage segments |