termdesc: use cbreak mode until interrogation is complete #1469

pull/1764/head
nick black 3 years ago committed by Nick Black
parent 73019e097f
commit be1356d213

@ -241,13 +241,13 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
fprintf(stderr, "Couldn't preserve terminal state for %d (%s)\n", fd, strerror(errno)); fprintf(stderr, "Couldn't preserve terminal state for %d (%s)\n", fd, strerror(errno));
return -1; return -1;
} }
} // enter cbreak mode regardless of user preference until we've performed
ti->utf8 = utf8; // terminal interrogation. at that point, we might restore original mode.
if(!nocbreak){
if(cbreak_mode(fd, &ti->tpreserved)){ if(cbreak_mode(fd, &ti->tpreserved)){
return -1; return -1;
} }
} }
ti->utf8 = utf8;
// allow the "rgb" boolean terminfo capability, a COLORTERM environment // allow the "rgb" boolean terminfo capability, a COLORTERM environment
// variable of either "truecolor" or "24bit", or unconditionally enable it // variable of either "truecolor" or "24bit", or unconditionally enable it
// for several terminals known to always support 8bpc rgb setaf/setab. // for several terminals known to always support 8bpc rgb setaf/setab.
@ -405,6 +405,11 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
if(ti->color_registers >= 64){ if(ti->color_registers >= 64){
setup_sixel_bitmaps(ti); setup_sixel_bitmaps(ti);
} }
if(!nocbreak){
if(tcsetattr(fd, TCSANOW, &ti->tpreserved)){
return -1;
}
}
if(apply_term_heuristics(ti, termname, fd)){ if(apply_term_heuristics(ti, termname, fd)){
goto err; goto err;
} }

Loading…
Cancel
Save