mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
fix a text coloring bug
This commit is contained in:
parent
1def60dbe1
commit
8e857587d7
@ -316,6 +316,22 @@ void addColorInString(std::string& str, const std::string& keyword,std::string c
|
||||
size_t pos = 0;
|
||||
while((pos = find_str_ci(str,keyword, pos)) != std::string::npos)
|
||||
{
|
||||
// do not add color if this portion of text is already colored.
|
||||
{
|
||||
MyGUI::TextIterator iterator (str);
|
||||
MyGUI::UString colour;
|
||||
while(iterator.moveNext())
|
||||
{
|
||||
size_t iteratorPos = iterator.getPosition();
|
||||
iterator.getTagColour(colour);
|
||||
if (iteratorPos == pos)
|
||||
break;
|
||||
}
|
||||
|
||||
if (colour == color1)
|
||||
return;
|
||||
}
|
||||
|
||||
str.insert(pos,color1);
|
||||
pos += color1.length();
|
||||
pos += keyword.length();
|
||||
|
Loading…
x
Reference in New Issue
Block a user