To my intense disgust,

...the code for interpreting pseudo-ANSI sequences in marked-up text
actually has a use.  Restore it in order to avoid a regression until
we can clean it up.
This commit is contained in:
Eric S. Raymond 2007-07-03 08:04:50 +00:00
parent dfd6fc8e50
commit c9bcc0e208

View file

@ -14,6 +14,7 @@
#include "font.hpp"
#include "marked-up_text.hpp"
#include "team.hpp"
#include "video.hpp"
#include "wassert.hpp"
@ -64,6 +65,27 @@ static std::string::const_iterator parse_markup(std::string::const_iterator i1,
break;
case NULL_MARKUP:
return i1+1;
// semi ANSI colour escape sequences at the start of the line for now only
case '\033':
if(i2 - i1 >= 4) {
++i1;
if(*i1 == '[') {
++i1;
if(*i1 == '3') {
++i1;
if(*i1 >= '0' && *i1 <= '9' && *(i1 + 1) == 'm')
{
if(*i1 != '0')
{
Uint32 rgb = team::get_side_rgb(lexical_cast<int, char>(*i1));
*colour = int_to_color(rgb);
}
++i1;
}
}
}
}
break;
case COLOR_TEXT:
{
//very primitive parsing for rgb value