mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 17:06:43 +00:00
fix a text coloring bug
This commit is contained in:
parent
1def60dbe1
commit
8e857587d7
1 changed files with 16 additions and 0 deletions
|
@ -316,6 +316,22 @@ void addColorInString(std::string& str, const std::string& keyword,std::string c
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
while((pos = find_str_ci(str,keyword, pos)) != std::string::npos)
|
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);
|
str.insert(pos,color1);
|
||||||
pos += color1.length();
|
pos += color1.length();
|
||||||
pos += keyword.length();
|
pos += keyword.length();
|
||||||
|
|
Loading…
Reference in a new issue