From 4d74d23fc67a2df7b67556e39805f0c7a6137748 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 7 Feb 2021 18:08:57 -0500 Subject: [PATCH] apply_term_heuristics: no braille on linux console #1334 --- src/lib/internal.h | 7 ++++--- src/lib/terminfo.c | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/internal.h b/src/lib/internal.h index 52157b276..2f2582bcb 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -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 { diff --git a/src/lib/terminfo.c b/src/lib/terminfo.c index c523959b7..24a6ba240 100644 --- a/src/lib/terminfo.c +++ b/src/lib/terminfo.c @@ -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){