Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The reason is because ncurses pre ABI 6, which includes the current version that most distributions including Debian and Amazon AMI use, <code>COLOR_PAIR(n)</code> cannot reference any defined pairs above 256. This is because the argument to <code>COLOR_PAIR(n)</code> is of type <code>cchar_t</code> . The lower 8 bits choose the color pair, and the rest are treated as bitflags <code>OR</code>ed in for specific terminal attributes. This is why you see blink, inverse, underline, etc. when you attempt to go beyond pair number 255 in your sample code.</p> <p>This is pretty unfortunate, and I plan to use a queue in my program to define colors on the fly using <code>init_pair()</code> and just overwrite the least recently used pairs as a compromise. I wrote the ncurses maintainer Thomas Dickey asking if there is a way to step outside of ncurses temporarily to write raw terminal codes and then return to ncurses. This was his reply:</p> <blockquote> <p>Essentially you'd have to forget about screen-optimization and just do your own drawing using the functions listed in terminfo(3), e.g., tigetstr, mvcur, tputs.</p> <p>You can exit temporarily from ncurses, but then have to repaint the screen. Otherwise ncurses will be confused about what is on the screen and where the cursor is.</p> </blockquote> <p>This solution seems to present too many pitfalls, but if you absolutely need more than 256 simultaneous pairs in an ncurses program (not counting pairs you could fake with the inverse attribute), then this is what you'll have to do.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload