Skip to content

Commit

Permalink
[textlayout] move addition of '\n' for the last line into LineBreakText
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed May 11, 2013
1 parent 8e20cfe commit 2c8c5de
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions xbmc/guilib/GUITextLayout.cpp
Expand Up @@ -232,9 +232,6 @@ bool CGUITextLayout::UpdateW(const CStdStringW &text, float maxWidth /*= 0*/, bo
// parse the text into our string objects
ParseText(text, parsedText);

// add \n to the end of the string
parsedText.push_back(L'\n');

// if we need to wrap the text, then do so
if (m_wrap && maxWidth > 0)
WrapText(parsedText, maxWidth);
Expand Down Expand Up @@ -559,6 +556,12 @@ void CGUITextLayout::LineBreakText(const vecText &text, vector<CGUIString> &line
}
pos++;
}
// handle the last line if non-empty
if (lineStart < text.end() && (nMaxLines <= 0 || lines.size() < (size_t)nMaxLines))
{
CGUIString string(lineStart, text.end(), true);
lines.push_back(string);
}
}

void CGUITextLayout::GetTextExtent(float &width, float &height) const
Expand Down

0 comments on commit 2c8c5de

Please sign in to comment.