Curses: don't iterate through unbound COLORS #369
On DirectColor-capable terminals with the proper terminfo database in use, COLORS is 2^24. Since the color map is only 64k entries, this resulted in a segfault. I've introduced NC::colorCount(), which bounds it by the previously assumed maximum (and usable range) of 256.
This commit is contained in:
@@ -424,8 +424,10 @@ void write_bindings(NC::Scrollpad &w)
|
||||
}
|
||||
|
||||
section(w, "", "List of available colors");
|
||||
for (int i = 0; i < COLORS; ++i)
|
||||
for (int i = 0; i < NC::colorCount(); ++i)
|
||||
{
|
||||
w << NC::Color(i, NC::Color::transparent) << i+1 << NC::Color::End << " ";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user