[automaton] extract older XTerm versions #2252

pull/2263/head
nick black 3 years ago
parent 4b89bf2a1a
commit a20ee4c75b
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -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…
Cancel
Save