Open ArEyeses79 opened 10 months ago
FWIW, The Pyplanet format stripper recently had this kind of thing fixed by using a negative lookbehind in their parsing regex: https://github.com/PyPlanet/PyPlanet/pull/1268/files#diff-a3b62d11ef71f60aee018f439821c9fa3031b8de71fdbbc44d36cf217aaa2178R4
Negative lookbehinds are not possible on std::regex which is currently what we are using. Need to think of a better solution.
Additionally, we also can not use PyPlanet's regex because it is GPL licensed.
The maniaplanet formatting code
$$
is supposed to display as a single $, and this is how it is displayed in game. However, it is not handled correctly by Openplanet. - The 'ColoredString' method correctly ignores formatting like$w
, yet not only does it not change a$$
to a single$
, it will also interpret the second$
as part of a formatting code. So, for example$$f0f
(which ingame outputs to $f0f) will be turned into$\$f0f
(a single$
and then the colorf0f
) (I am unsure of any reason why ColoredString should keep the$$
as 2$
, and it feels better to remove them here than in every possible UI element that could display the result) - The 'StripFormatCodes' method also ignores the$$
formatting; it will turn$$f0f
into$
instead of$f0f
- While I think StripNonColorFormatCodes should leave$$
so that its output can be passed to ColoredString, it also has this issue with codes such as$$w
, which ingame is displayed as $w, but it incorrectly removes the$w
from.