Better color code detection
Should produce less false positives.
This commit is contained in:
parent
b204b3e855
commit
4d599e877f
@ -25,7 +25,7 @@ std::string remove_colors(const std::string &text)
|
||||
auto newtext{text};
|
||||
|
||||
size_t pos{0};
|
||||
while ((pos = newtext.find('\x1b')) != std::string::npos)
|
||||
while ((pos = newtext.find("\x1b[")) != std::string::npos)
|
||||
{
|
||||
const auto nchars{newtext.find('m', pos) + 1 - pos};
|
||||
newtext.replace(pos, nchars, "");
|
||||
|
Loading…
x
Reference in New Issue
Block a user