mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
check for support in ncdirect_on_styles()
This commit is contained in:
parent
540442fe9f
commit
93fe6db376
@ -959,12 +959,15 @@ int ncdirect_styles_on(ncdirect* n, unsigned stylebits){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ncdirect_on_styles(ncdirect* n, unsigned stylebits){
|
int ncdirect_on_styles(ncdirect* n, unsigned stylebits){
|
||||||
uint32_t stylemask = n->stylemask | stylebits;
|
if((stylebits & n->tcache.supported_styles) < stylebits){ // unsupported styles
|
||||||
if(ncdirect_style_emit(n, stylemask, n->ttyfp) == 0){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
uint32_t stylemask = n->stylemask | stylebits;
|
||||||
|
if(ncdirect_style_emit(n, stylemask, n->ttyfp)){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ncdirect_styles_off(ncdirect* n, unsigned stylebits){
|
int ncdirect_styles_off(ncdirect* n, unsigned stylebits){
|
||||||
return ncdirect_off_styles(n, stylebits);
|
return ncdirect_off_styles(n, stylebits);
|
||||||
@ -977,11 +980,11 @@ unsigned ncdirect_styles(ncdirect* n){
|
|||||||
// turn off any specified stylebits
|
// turn off any specified stylebits
|
||||||
int ncdirect_off_styles(ncdirect* n, unsigned stylebits){
|
int ncdirect_off_styles(ncdirect* n, unsigned stylebits){
|
||||||
uint32_t stylemask = n->stylemask & ~stylebits;
|
uint32_t stylemask = n->stylemask & ~stylebits;
|
||||||
if(ncdirect_style_emit(n, stylemask, n->ttyfp) == 0){
|
if(ncdirect_style_emit(n, stylemask, n->ttyfp)){
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ncdirect_styles_set(ncdirect* n, unsigned stylebits){
|
int ncdirect_styles_set(ncdirect* n, unsigned stylebits){
|
||||||
return ncdirect_set_styles(n, stylebits);
|
return ncdirect_set_styles(n, stylebits);
|
||||||
|
Loading…
Reference in New Issue
Block a user