flush before making SUM decision, to get true value

pull/1965/head
nick black 3 years ago
parent 17d5b4064a
commit 05fdd0b117
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1126,12 +1126,16 @@ notcurses_rasterize_inner(notcurses* nc, ncpile* p, FILE* out, unsigned* asu){
if(rasterize_core(nc, p, out, 1)){ if(rasterize_core(nc, p, out, 1)){
return -1; return -1;
} }
// need to flush before doing SUMode size check, to update mstrsize
if(ncflush(out)){
return -1;
}
#define MIN_SUMODE_SIZE BUFSIZ #define MIN_SUMODE_SIZE BUFSIZ
if(*asu){ if(*asu){
if(nc->rstate.mstrsize >= MIN_SUMODE_SIZE){ if(nc->rstate.mstrsize >= MIN_SUMODE_SIZE){
const char* endasu = get_escape(&nc->tcache, ESCAPE_ESUM); const char* endasu = get_escape(&nc->tcache, ESCAPE_ESUM);
if(endasu){ if(endasu){
if(fprintf(out, "%s", endasu) < 0){ if(fprintf(out, "%s", endasu) < 0 || ncflush(out)){
*asu = 0; *asu = 0;
} }
}else{ }else{
@ -1142,9 +1146,6 @@ notcurses_rasterize_inner(notcurses* nc, ncpile* p, FILE* out, unsigned* asu){
} }
} }
#undef MIN_SUMODE_SIZE #undef MIN_SUMODE_SIZE
if(ncflush(out)){
return -1;
}
return nc->rstate.mstrsize; return nc->rstate.mstrsize;
} }

@ -413,6 +413,17 @@ add_smulx_escapes(tinfo* ti, size_t* tablelen, size_t* tableused){
return 0; return 0;
} }
static inline void
kill_escape(tinfo* ti, escape_e e){
ti->escindices[e] = 0;
}
static void
kill_appsync_escapes(tinfo* ti){
kill_escape(ti, ESCAPE_BSUM);
kill_escape(ti, ESCAPE_ESUM);
}
static int static int
add_appsync_escapes_sm(tinfo* ti, size_t* tablelen, size_t* tableused){ add_appsync_escapes_sm(tinfo* ti, size_t* tablelen, size_t* tableused){
if(get_escape(ti, ESCAPE_BSUM)){ if(get_escape(ti, ESCAPE_BSUM)){
@ -496,8 +507,9 @@ apply_term_heuristics(tinfo* ti, const char* termname, int fd,
if(add_pushcolors_escapes(ti, tablelen, tableused)){ if(add_pushcolors_escapes(ti, tablelen, tableused)){
return -1; return -1;
} }
// FIXME remove synchronization mode; it's still broken in 0.21.2, and we // kitty SUM doesn't want long sequences, which is exactly where we use
// don't need it anyway // it. remove support (we pick it up from queries).
kill_appsync_escapes(ti);
}else if(qterm == TERMINAL_ALACRITTY){ }else if(qterm == TERMINAL_ALACRITTY){
termname = "Alacritty"; termname = "Alacritty";
ti->caps.quadrants = true; ti->caps.quadrants = true;
@ -801,17 +813,17 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
} }
} }
} }
if(appsync_advertised){
if(add_appsync_escapes_sm(ti, &tablelen, &tableused)){
goto err;
}
}
bool invertsixel = false; bool invertsixel = false;
if(apply_term_heuristics(ti, termname, fd, qterm, &tablelen, &tableused, if(apply_term_heuristics(ti, termname, fd, qterm, &tablelen, &tableused,
&invertsixel)){ &invertsixel)){
ncinputlayer_stop(&ti->input); ncinputlayer_stop(&ti->input);
goto err; goto err;
} }
if(appsync_advertised){
if(add_appsync_escapes_sm(ti, &tablelen, &tableused)){
goto err;
}
}
build_supported_styles(ti); build_supported_styles(ti);
// our current sixel quantization algorithm requires at least 64 color // our current sixel quantization algorithm requires at least 64 color
// registers. we make use of no more than 256. this needs to happen // registers. we make use of no more than 256. this needs to happen

Loading…
Cancel
Save