mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
rendering: lack of term capability is not error #768
If we don't have setaf/setab, then we're not going to set color. OK, fine. Don't regard it as an error during notcurses_rasterization(), just don't emit the escape. This is necessary to run on terminals like vt100, which in turn is necessary to run unit tests properly on Redhat's koji. Also, use notcurses_canfade() to avoid just breaking during fades in intro and trans demos.
This commit is contained in:
parent
284dfc4fad
commit
5a9e0c6f05
@ -132,6 +132,9 @@ int intro(struct notcurses* nc){
|
||||
demo_nanosleep(nc, &iter);
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &now);
|
||||
}while(timespec_to_ns(&now) < deadline);
|
||||
if(!notcurses_canfade(nc)){
|
||||
return 0;
|
||||
}
|
||||
struct timespec fade = demodelay;
|
||||
return ncplane_fadeout(ncp, &fade, demo_fader, NULL);
|
||||
}
|
||||
|
@ -258,14 +258,16 @@ int trans_demo(struct notcurses* nc){
|
||||
++x;
|
||||
}
|
||||
}
|
||||
struct ncplane* l = legend(nc, "what say we explore transparency together?");
|
||||
DEMO_RENDER(nc);
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &now);
|
||||
int err;
|
||||
if( (err = ncplane_pulse(l, &demodelay, pulser, &now)) != 2){
|
||||
return err;
|
||||
if(notcurses_canfade(nc)){
|
||||
struct ncplane* l = legend(nc, "what say we explore transparency together?");
|
||||
DEMO_RENDER(nc);
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &now);
|
||||
int err;
|
||||
if( (err = ncplane_pulse(l, &demodelay, pulser, &now)) != 2){
|
||||
return err;
|
||||
}
|
||||
ncplane_destroy(l);
|
||||
}
|
||||
ncplane_destroy(l);
|
||||
return slidepanel(nc);
|
||||
}
|
||||
|
@ -538,11 +538,17 @@ term_emit(const char* name __attribute__ ((unused)), const char* seq,
|
||||
|
||||
static inline int
|
||||
term_bg_palindex(const notcurses* nc, FILE* out, unsigned pal){
|
||||
if(nc->tcache.setab == NULL){
|
||||
return 0;
|
||||
}
|
||||
return term_emit("setab", tiparm(nc->tcache.setab, pal), out, false);
|
||||
}
|
||||
|
||||
static inline int
|
||||
term_fg_palindex(const notcurses* nc, FILE* out, unsigned pal){
|
||||
if(nc->tcache.setaf == NULL){
|
||||
return 0;
|
||||
}
|
||||
return term_emit("setaf", tiparm(nc->tcache.setaf, pal), out, false);
|
||||
}
|
||||
|
||||
|
@ -655,7 +655,7 @@ term_bg_rgb8(bool RGBflag, const char* setab, int colors, FILE* out,
|
||||
return term_esc_rgb(out, false, r, g, b);
|
||||
}else{
|
||||
if(setab == NULL){
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
// For 256-color indexed mode, start constructing a palette based off
|
||||
// the inputs *if we can change the palette*. If more than 256 are used on
|
||||
@ -682,7 +682,7 @@ term_fg_rgb8(bool RGBflag, const char* setaf, int colors, FILE* out,
|
||||
return term_esc_rgb(out, true, r, g, b);
|
||||
}else{
|
||||
if(setaf == NULL){
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
// For 256-color indexed mode, start constructing a palette based off
|
||||
// the inputs *if we can change the palette*. If more than 256 are used on
|
||||
@ -926,7 +926,9 @@ notcurses_rasterize(notcurses* nc, const struct crender* rvec){
|
||||
if((!noforeground && cell_fg_default_p(srccell)) || (!nobackground && cell_bg_default_p(srccell))){
|
||||
if(!nc->rstate.defaultelidable){
|
||||
++nc->stats.defaultemissions;
|
||||
ret |= term_emit("op", nc->tcache.op, out, false);
|
||||
if(nc->tcache.op){
|
||||
ret |= term_emit("op", nc->tcache.op, out, false);
|
||||
}
|
||||
}else{
|
||||
++nc->stats.defaultelisions;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user