ncurses: fix color support

This commit is contained in:
Maxime Coste 2011-10-07 14:28:13 +00:00
parent 10106e8c8e
commit 868a2f8107

View File

@ -47,11 +47,14 @@ void set_color(Color fg_color, Color bg_color)
{ {
static std::map<std::pair<Color, Color>, int> colorpairs; static std::map<std::pair<Color, Color>, int> colorpairs;
static int current_pair = -1; static int current_pair = -1;
static int next_pair = 0; static int next_pair = 1;
if (current_pair != -1) if (current_pair != -1)
attroff(COLOR_PAIR(current_pair)); attroff(COLOR_PAIR(current_pair));
if (fg_color == Color::Default and bg_color == Color::Default)
return;
std::pair<Color, Color> colorpair(fg_color, bg_color); std::pair<Color, Color> colorpair(fg_color, bg_color);
auto it = colorpairs.find(colorpair); auto it = colorpairs.find(colorpair);
if (it != colorpairs.end()) if (it != colorpairs.end())