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:
@@ -219,6 +219,10 @@ void disable();
|
||||
/// @param enable_colors enables colors
|
||||
void initScreen(bool enable_colors, bool enable_mouse);
|
||||
|
||||
// Get the maximum supported color index (but only once initScreen() has been
|
||||
// successfully called). This might be less than the advertised COLORS.
|
||||
int colorCount();
|
||||
|
||||
/// Pauses the screen (e.g. for running an external command)
|
||||
void pauseScreen();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user