mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
recognize Tc unofficial terminfo capability as synonym for RGB
This commit is contained in:
parent
bd451aa087
commit
85e55de569
@ -183,7 +183,7 @@ each release. Download it, and install the contents as you deem fit.
|
||||
**Narrow**, heh).
|
||||
|
||||
* If your terminal supports 3x8bit RGB color via `setaf` and `setbf` (most modern
|
||||
terminals), but doesn't export the `rgb` terminfo capability, you can export
|
||||
terminals), but exports neither the `RGB` nor `Tc` terminfo capability, you can export
|
||||
the `COLORTERM` environment variable as `truecolor` or `24bit`. Note that some
|
||||
terminals accept a 24-bit specification, but map it down to fewer colors.
|
||||
RGB is enabled whenever [Foot, Contour, WezTerm, or Kitty](TERMINALS.md) is
|
||||
|
@ -197,7 +197,7 @@ void Tick(ncpp::NotCurses* nc, uint64_t sec) {
|
||||
|
||||
void Ticker(ncpp::NotCurses* nc) {
|
||||
do{
|
||||
std::this_thread::sleep_for(std::chrono::seconds{1});
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{100});
|
||||
const uint64_t sec = (timenow_to_ns() - start) / NANOSECS_IN_SEC;
|
||||
Tick(nc, sec);
|
||||
}while(!done);
|
||||
|
@ -467,6 +467,7 @@ handle_queued_input(ncinputlayer* nc, ncinput* ni, int leftmargin, int topmargin
|
||||
return ret;
|
||||
}
|
||||
|
||||
// this is where the user input chain actually calls read(2).
|
||||
static char32_t
|
||||
handle_input(ncinputlayer* nc, ncinput* ni, int leftmargin, int topmargin,
|
||||
const sigset_t* sigmask){
|
||||
|
@ -91,19 +91,19 @@ setup_kitty_bitmaps(tinfo* ti, int fd, int sixel_maxy_pristine){
|
||||
|
||||
static bool
|
||||
query_rgb(void){
|
||||
bool rgb = tigetflag("RGB") == 1;
|
||||
bool rgb = (tigetflag("RGB") > 1 || tigetflag("Tc") > 1);
|
||||
if(!rgb){
|
||||
// RGB terminfo capability being a new thing (as of ncurses 6.1), it's not commonly found in
|
||||
// terminal entries today. COLORTERM, however, is a de-facto (if imperfect/kludgy) standard way
|
||||
// of indicating TrueColor support for a terminal. The variable takes one of two case-sensitive
|
||||
// RGB terminfo capability being a new thing (as of ncurses 6.1), it's not
|
||||
// commonly found in terminal entries today. COLORTERM, however, is a
|
||||
// de-facto (if imperfect/kludgy) standard way of indicating TrueColor
|
||||
// support for a terminal. The variable takes one of two case-sensitive
|
||||
// values:
|
||||
//
|
||||
// truecolor
|
||||
// 24bit
|
||||
//
|
||||
// https://gist.github.com/XVilka/8346728#true-color-detection gives some more information about
|
||||
// the topic
|
||||
//
|
||||
// https://gist.github.com/XVilka/8346728#true-color-detection gives some
|
||||
// more information about the topic.
|
||||
const char* cterm = getenv("COLORTERM");
|
||||
rgb = cterm && (strcmp(cterm, "truecolor") == 0 || strcmp(cterm, "24bit") == 0);
|
||||
}
|
||||
@ -601,7 +601,6 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
|
||||
ti->caps.colors = colors;
|
||||
}
|
||||
ti->caps.rgb = query_rgb(); // independent of colors
|
||||
// verify that the terminal provides cursor addressing (absolute movement)
|
||||
const struct strtdesc {
|
||||
escape_e esc;
|
||||
const char* tinfo;
|
||||
@ -645,6 +644,7 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
// verify that the terminal provides cursor addressing (absolute movement)
|
||||
if(ti->escindices[ESCAPE_CUP] == 0){
|
||||
fprintf(stderr, "Required terminfo capability 'cup' not defined\n");
|
||||
goto err;
|
||||
|
Loading…
Reference in New Issue
Block a user