apply_term_heuristics: no braille on linux console #1334

This commit is contained in:
nick black 2021-02-07 18:08:57 -05:00
parent 833f1b13bf
commit 4d74d23fc6
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 7 additions and 3 deletions

View File

@ -264,20 +264,21 @@ typedef struct tinfo {
char* smkx; // enter keypad transmit mode (keypad_xmit)
char* rmkx; // leave keypad transmit mode (keypad_local)
char* getm; // get mouse events
char* smcup; // enter alternate mode
char* rmcup; // restore primary mode
bool RGBflag; // "RGB" flag for 24bpc truecolor
bool CCCflag; // "CCC" flag for palette set capability
bool BCEflag; // "BCE" flag for erases with background color
bool AMflag; // "AM" flag for automatic movement to next line
bool utf8; // are we using utf-8 encoding, as hoped?
char* smcup; // enter alternate mode
char* rmcup; // restore primary mode
// kitty interprets an RGB background that matches the default background
// color *as* the default background, meaning it'll be translucent if
// background_opaque is in use. detect this, and avoid the default if so.
// bg_collides_default is either 0x0000000 or 0x1RRGGBB.
uint32_t bg_collides_default;
bool sextants; // do we have Unicode 13 sextant support?
bool sextants; // do we have (good, vetted) Unicode 13 sextant support?
bool braille; // do we have Braille support? (linux console does not)
} tinfo;
typedef struct ncinputlayer {

View File

@ -50,6 +50,7 @@ apply_term_heuristics(tinfo* ti, const char* termname){
// setupterm interprets a missing/empty TERM variable as the special value “unknown”.
termname = "unknown";
}
ti->braille = true;
if(strstr(termname, "kitty")){ // kitty (https://sw.kovidgoyal.net/kitty/)
// see https://sw.kovidgoyal.net/kitty/protocol-extensions.html
// FIXME detect the actual default background color; this assumes it to
@ -58,6 +59,8 @@ apply_term_heuristics(tinfo* ti, const char* termname){
ti->sextants = true; // work since bugfix in 0.19.3
}else if(strstr(termname, "vte") || strstr(termname, "gnome") || strstr(termname, "xfce")){
ti->sextants = true; // VTE has long enjoyed good sextant support
}else if(strcmp(termname, "linux") == 0){
ti->braille = false; // no braille, no sextants in linux console
}
// run a wcwidth() to guarantee libc Unicode 13 support
if(wcwidth(L'🬸') < 0){