mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
termdesc: identify kitty+version from XTVERSION response #1798
This commit is contained in:
parent
e4656dbd77
commit
44e85d2f05
@ -738,13 +738,13 @@ stash_string(query_state* inits){
|
||||
//fprintf(stderr, "string terminator after %d [%s]\n", inits->stringstate, inits->runstring);
|
||||
switch(inits->stringstate){
|
||||
case STATE_XTVERSION1:{
|
||||
int xversion;
|
||||
if(sscanf(inits->runstring, "XTerm(%d)", &xversion) == 1){
|
||||
int version;
|
||||
if(sscanf(inits->runstring, "XTerm(%d)", &version) == 1){
|
||||
// enough space for everything besides "XTerm()"
|
||||
size_t bytes = strlen(inits->runstring) - 7 + 1;
|
||||
inits->version = malloc(bytes);
|
||||
if(inits->version){
|
||||
sprintf(inits->version, "%d", xversion);
|
||||
sprintf(inits->version, "%d", version); // FIXME replace with memcpy
|
||||
}
|
||||
inits->qterm = TERMINAL_XTERM;
|
||||
}else if(strncmp(inits->runstring, "WezTerm ", strlen("WezTerm ")) == 0){
|
||||
@ -753,6 +753,14 @@ stash_string(query_state* inits){
|
||||
}else if(strncmp(inits->runstring, "contour ", strlen("contour ")) == 0){
|
||||
extract_version(inits, "contour ");
|
||||
inits->qterm = TERMINAL_CONTOUR;
|
||||
#define KITTYVT "kitty("
|
||||
}else if(strncmp(inits->runstring, KITTYVT, strlen(KITTYVT)) == 0){
|
||||
if(inits->runstring[inits->stridx - 1] == ')'){
|
||||
inits->runstring[inits->stridx - 1] = '\0';
|
||||
extract_version(inits, "kitty(");
|
||||
inits->qterm = TERMINAL_KITTY;
|
||||
}
|
||||
#undef KITTYVT
|
||||
}
|
||||
break;
|
||||
}case STATE_XTGETTCAP_TERMNAME1:
|
||||
|
Loading…
Reference in New Issue
Block a user