mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-04 06:00:30 +00:00
[automaton] extract older XTerm versions #2252
This commit is contained in:
parent
4b89bf2a1a
commit
a20ee4c75b
26
src/lib/in.c
26
src/lib/in.c
@ -947,12 +947,32 @@ da1_attrs_cb(inputctx* ictx){
|
||||
return 1;
|
||||
}
|
||||
|
||||
// we use secondary device attributes to recognize the alacritty crate
|
||||
// version, and to ascertain the version of old, pre-XTVERSION XTerm.
|
||||
static int
|
||||
da2_cb(inputctx* ictx){
|
||||
loginfo("read secondary device attributes\n");
|
||||
if(ictx->initdata == NULL){
|
||||
return 2;
|
||||
}
|
||||
amata_next_numeric(&ictx->amata, "\x1b[>", ';');
|
||||
unsigned pv = amata_next_numeric(&ictx->amata, "", ';');
|
||||
int maj, min, patch;
|
||||
if(pv == 0){
|
||||
return 2;
|
||||
}
|
||||
if(ictx->initdata->qterm == TERMINAL_XTERM){
|
||||
if(ictx->initdata->version == NULL){
|
||||
char ver[8];
|
||||
int s = snprintf(ver, sizeof(ver), "%u", pv);
|
||||
if(s < 0 || (unsigned)s >= sizeof(ver)){
|
||||
logerror("bad version: %u\n", pv);
|
||||
}else{
|
||||
ictx->initdata->version = strdup(ver);
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
// SDA yields up Alacritty's crate version, but it doesn't unambiguously
|
||||
// identify Alacritty. If we've got any other version information, don't
|
||||
// use this. use the second parameter (Pv).
|
||||
@ -968,12 +988,6 @@ da2_cb(inputctx* ictx){
|
||||
termname ? termname : "unset");
|
||||
return 2;
|
||||
}
|
||||
amata_next_numeric(&ictx->amata, "\x1b[>", ';');
|
||||
unsigned pv = amata_next_numeric(&ictx->amata, "", ';');
|
||||
int maj, min, patch;
|
||||
if(pv == 0){
|
||||
return 2;
|
||||
}
|
||||
maj = pv / 10000;
|
||||
min = (pv % 10000) / 100;
|
||||
patch = pv % 100;
|
||||
|
Loading…
Reference in New Issue
Block a user