Skip to content

Commit

Permalink
Fix color tag didn't hide bug introduced by PR2725.
Browse files Browse the repository at this point in the history
  • Loading branch information
ulion committed May 13, 2013
1 parent bf91362 commit 937e565
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xbmc/guilib/GUITextLayout.cpp
Expand Up @@ -354,6 +354,7 @@ void CGUITextLayout::ParseText(const CStdStringW &text, uint32_t defaultStyle, v
{ {
uint32_t newStyle = 0; uint32_t newStyle = 0;
color_t newColor = currentColor; color_t newColor = currentColor;
bool colorTagChange = false;
bool newLine = false; bool newLine = false;
// have a [ - check if it's an ON or OFF switch // have a [ - check if it's an ON or OFF switch
bool on(true); bool on(true);
Expand Down Expand Up @@ -418,17 +419,19 @@ void CGUITextLayout::ParseText(const CStdStringW &text, uint32_t defaultStyle, v
// reuse existing color // reuse existing color
newColor = it - colors.begin(); newColor = it - colors.begin();
colorStack.push(newColor); colorStack.push(newColor);
colorTagChange = true;
} }
else if (!on && finish == pos + 5 && colorStack.size() > 1) else if (!on && finish == pos + 5 && colorStack.size() > 1)
{ // revert to previous color { // revert to previous color
colorStack.pop(); colorStack.pop();
newColor = colorStack.top(); newColor = colorStack.top();
colorTagChange = true;
} }
if (finish != CStdString::npos) if (finish != CStdString::npos)
pos = finish + 1; pos = finish + 1;
} }


if (newStyle || newColor != currentColor || newLine) if (newStyle || colorTagChange || newLine)
{ // we have a new style or a new color, so format up the previous segment { // we have a new style or a new color, so format up the previous segment
CStdStringW subText = text.Mid(startPos, endPos - startPos); CStdStringW subText = text.Mid(startPos, endPos - startPos);
if (currentStyle & FONT_STYLE_UPPERCASE) if (currentStyle & FONT_STYLE_UPPERCASE)
Expand Down

0 comments on commit 937e565

Please sign in to comment.