A bit better method of setting foreground vs. background.

This commit is contained in:
Zed A. Shaw 2024-11-01 04:15:37 -04:00
parent 2d550978b8
commit 6ca4614fcb
2 changed files with 15 additions and 15 deletions

View file

@ -63,10 +63,10 @@ static const char _foo_trans_targs[] = {
static const char _foo_trans_actions[] = {
0, 7, 0, 0, 9, 9, 0, 0,
0, 0, 0, 0, 5, 0, 0, 0,
0, 0, 0, 0, 3, 0, 0, 0,
1, 0, 13, 0, 0, 1, 0, 16,
0, 0, 1, 0, 22, 0, 0, 0,
0, 0, 0, 0, 0, 0, 3, 0,
0, 0, 0, 0, 0, 0, 5, 0,
0, 7, 11, 19, 0
};
@ -88,11 +88,11 @@ static const int foo_en_main = 18;
bool parse_ansi(std::string_view codes) {
const char *start = NULL;
int cs = 0;
uint8_t value = 0;
unsigned int value = 0;
const char *p = codes.data();
const char *pe = p + codes.size();
const char *eof = pe;
bool fgcolor = false;
bool is_fg = false;
sf::Color color;
@ -198,11 +198,11 @@ _match:
break;
case 3:
#line 26 ".\\ansi_parser.rl"
{ fgcolor = false; }
{ is_fg = true; }
break;
case 4:
#line 27 ".\\ansi_parser.rl"
{ fgcolor = true; }
{ is_fg = false; }
break;
case 5:
#line 29 ".\\ansi_parser.rl"
@ -229,7 +229,7 @@ _match:
case 10:
#line 39 ".\\ansi_parser.rl"
{
println("fg? {}, sf:Color: {},{},{},{}", fgcolor, color.r, color.g, color.b, color.a);
println("fg? {}, sf:Color: {},{},{},{}", is_fg, color.r, color.g, color.b, color.a);
}
break;
#line 211 ".\\ansi_parser.cpp"
@ -251,7 +251,7 @@ _again:
case 10:
#line 39 ".\\ansi_parser.rl"
{
println("fg? {}, sf:Color: {},{},{},{}", fgcolor, color.r, color.g, color.b, color.a);
println("fg? {}, sf:Color: {},{},{},{}", is_fg, color.r, color.g, color.b, color.a);
}
break;
#line 231 ".\\ansi_parser.cpp"