Skip to content
Snippets Groups Projects
Commit f26eb91c authored by Yuri Chebotarev's avatar Yuri Chebotarev
Browse files

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
parent 884e08b5
No related branches found
No related tags found
No related merge requests found
...@@ -1616,7 +1616,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para ...@@ -1616,7 +1616,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
part = (S32)LLTextParser::MIDDLE; part = (S32)LLTextParser::MIDDLE;
} }
std::string subtext=text.substr(0,start); std::string subtext=text.substr(0,start);
appendAndHighlightTextImpl(subtext, part, style_params); appendAndHighlightText(subtext, part, style_params);
} }
// output an optional icon before the Url // output an optional icon before the Url
...@@ -1637,11 +1637,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para ...@@ -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) // output the styled Url (unless we've been asked to suppress hyperlinking)
if (match.isLinkDisabled()) if (match.isLinkDisabled())
{ {
appendAndHighlightTextImpl(match.getLabel(), part, style_params); appendAndHighlightText(match.getLabel(), part, style_params);
} }
else else
{ {
appendAndHighlightTextImpl(match.getLabel(), part, link_params); appendAndHighlightText(match.getLabel(), part, link_params);
// set the tooltip for the Url label // set the tooltip for the Url label
if (! match.getTooltip().empty()) if (! match.getTooltip().empty())
...@@ -1669,11 +1669,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para ...@@ -1669,11 +1669,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
if (part != (S32)LLTextParser::WHOLE) if (part != (S32)LLTextParser::WHOLE)
part=(S32)LLTextParser::END; part=(S32)LLTextParser::END;
if (end < (S32)text.length()) if (end < (S32)text.length())
appendAndHighlightTextImpl(text, part, style_params); appendAndHighlightText(text, part, style_params);
} }
else 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 ...@@ -1684,23 +1684,7 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c
if(prepend_newline) if(prepend_newline)
appendLineBreakSegment(input_params); appendLineBreakSegment(input_params);
std::string::size_type start = 0; appendTextImpl(new_text,input_params);
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);
} }
void LLTextBase::needsReflow(S32 index) void LLTextBase::needsReflow(S32 index)
...@@ -1803,13 +1787,10 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig ...@@ -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 (new_text.empty()) return;
if(prepend_newline)
appendLineBreakSegment(style_params);
std::string::size_type start = 0; std::string::size_type start = 0;
std::string::size_type pos = new_text.find("\n",start); std::string::size_type pos = new_text.find("\n",start);
......
...@@ -278,7 +278,7 @@ class LLTextBase ...@@ -278,7 +278,7 @@ class LLTextBase
S32 insertStringNoUndo(S32 pos, const LLWString &wstr, segment_vec_t* segments = NULL); // returns num of chars actually inserted 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 removeStringNoUndo(S32 pos, S32 length);
S32 overwriteCharNoUndo(S32 pos, llwchar wc); 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 // manage segments
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment