mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
migrate all direct uses to ncplane_notcurses()
This commit is contained in:
parent
5215338e00
commit
9829abf0d0
@ -863,12 +863,13 @@ int ncblit_rgba(const void* data, int linesize, const struct ncvisual_options* v
|
||||
}
|
||||
ncblitter_e blitter;
|
||||
if(!vopts || vopts->blitter == NCBLIT_DEFAULT){
|
||||
blitter = ncvisual_default_blitter(notcurses_canutf8(nc->nc), NCSCALE_NONE);
|
||||
blitter = ncvisual_default_blitter(notcurses_canutf8(ncplane_notcurses(nc)),
|
||||
NCSCALE_NONE);
|
||||
}else{
|
||||
blitter = vopts->blitter;
|
||||
}
|
||||
const bool degrade = !(vopts->flags & NCVISUAL_OPTION_NODEGRADE);
|
||||
const struct blitset* bset = lookup_blitset(notcurses_canutf8(nc->nc),
|
||||
const struct blitset* bset = lookup_blitset(notcurses_canutf8(ncplane_notcurses(nc)),
|
||||
blitter, degrade);
|
||||
if(bset == NULL){
|
||||
return -1;
|
||||
|
@ -140,9 +140,9 @@ int ncplane_fadein_iteration(ncplane* n, ncfadectx* nctx, int iter,
|
||||
sleepspec.tv_nsec = nextwake % NANOSECS_IN_SEC;
|
||||
int ret = 0;
|
||||
if(fader){
|
||||
ret |= fader(n->nc, n, &sleepspec, curry);
|
||||
ret |= fader(ncplane_notcurses(n), n, &sleepspec, curry);
|
||||
}else{
|
||||
ret |= notcurses_render(n->nc);
|
||||
ret |= notcurses_render(ncplane_notcurses(n));
|
||||
// clock_nanosleep() has no love for CLOCK_MONOTONIC_RAW, at least as
|
||||
// of Glibc 2.29 + Linux 5.3 (or FreeBSD 12) :/.
|
||||
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &sleepspec, NULL);
|
||||
@ -220,9 +220,9 @@ int ncplane_fadeout_iteration(ncplane* n, ncfadectx* nctx, int iter,
|
||||
sleepspec.tv_nsec = nextwake % NANOSECS_IN_SEC;
|
||||
int ret;
|
||||
if(fader){
|
||||
ret = fader(n->nc, n, &sleepspec, curry);
|
||||
ret = fader(ncplane_notcurses(n), n, &sleepspec, curry);
|
||||
}else{
|
||||
ret = notcurses_render(n->nc);
|
||||
ret = notcurses_render(ncplane_notcurses(n));
|
||||
// clock_nanosleep() has no love for CLOCK_MONOTONIC_RAW, at least as
|
||||
// of Glibc 2.29 + Linux 5.3 (or FreeBSD 12) :/.
|
||||
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &sleepspec, NULL);
|
||||
@ -232,7 +232,8 @@ int ncplane_fadeout_iteration(ncplane* n, ncfadectx* nctx, int iter,
|
||||
|
||||
static ncfadectx*
|
||||
ncfadectx_setup_internal(ncplane* n, const struct timespec* ts){
|
||||
if(!n->nc->tcache.RGBflag && !n->nc->tcache.CCCflag){ // terminal can't fade
|
||||
if(!ncplane_notcurses(n)->tcache.RGBflag &&
|
||||
!ncplane_notcurses(n)->tcache.CCCflag){ // terminal can't fade
|
||||
return NULL;
|
||||
}
|
||||
ncfadectx* nctx = malloc(sizeof(*nctx));
|
||||
@ -286,9 +287,9 @@ int ncplane_fadein(ncplane* n, const struct timespec* ts, fadecb fader, void* cu
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
if(fader){
|
||||
fader(n->nc, n, &now, curry);
|
||||
fader(ncplane_notcurses(n), n, &now, curry);
|
||||
}else{
|
||||
notcurses_render(n->nc);
|
||||
notcurses_render(ncplane_notcurses(n));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -300,7 +301,8 @@ int ncplane_fadein(ncplane* n, const struct timespec* ts, fadecb fader, void* cu
|
||||
int ncplane_pulse(ncplane* n, const struct timespec* ts, fadecb fader, void* curry){
|
||||
ncfadectx pp;
|
||||
int ret;
|
||||
if(!n->nc->tcache.RGBflag && !n->nc->tcache.CCCflag){ // terminal can't fade
|
||||
if(!ncplane_notcurses(n)->tcache.RGBflag &&
|
||||
!ncplane_notcurses(n)->tcache.CCCflag){ // terminal can't fade
|
||||
return -1;
|
||||
}
|
||||
if(alloc_ncplane_palette(n, &pp, ts)){
|
||||
|
@ -101,7 +101,7 @@ ncfdplane_create_internal(ncplane* n, const ncfdplane_options* opts, int fd,
|
||||
ncfdplane_callback cbfxn, ncfdplane_done_cb donecbfxn,
|
||||
bool thread){
|
||||
if(opts->flags > 0){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", opts->flags);
|
||||
}
|
||||
ncfdplane* ret = malloc(sizeof(*ret));
|
||||
if(ret == NULL){
|
||||
@ -302,7 +302,7 @@ ncsubproc* ncsubproc_createv(ncplane* n, const ncsubproc_options* opts,
|
||||
return NULL;
|
||||
}
|
||||
if(opts->flags > 0){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", opts->flags);
|
||||
}
|
||||
int fd = -1;
|
||||
ncsubproc* ret = malloc(sizeof(*ret));
|
||||
@ -337,7 +337,7 @@ ncsubproc* ncsubproc_createvp(ncplane* n, const ncsubproc_options* opts,
|
||||
return NULL;
|
||||
}
|
||||
if(opts->flags > 0){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", opts->flags);
|
||||
}
|
||||
int fd = -1;
|
||||
ncsubproc* ret = malloc(sizeof(*ret));
|
||||
@ -372,7 +372,7 @@ ncsubproc* ncsubproc_createvpe(ncplane* n, const ncsubproc_options* opts,
|
||||
return NULL;
|
||||
}
|
||||
if(opts->flags > 0){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", opts->flags);
|
||||
}
|
||||
int fd = -1;
|
||||
ncsubproc* ret = malloc(sizeof(*ret));
|
||||
|
@ -146,7 +146,7 @@ calc_highgradient(cell* c, uint32_t ul, uint32_t ur, uint32_t ll,
|
||||
|
||||
int ncplane_highgradient(ncplane* n, uint32_t ul, uint32_t ur,
|
||||
uint32_t ll, uint32_t lr, int ystop, int xstop){
|
||||
if(!notcurses_canutf8(n->nc)){
|
||||
if(!notcurses_canutf8(ncplane_notcurses(n))){
|
||||
return -1;
|
||||
}
|
||||
if(check_gradient_channel_args(ul, ur, ll, lr)){
|
||||
@ -207,7 +207,7 @@ int ncplane_gradient(ncplane* n, const char* egc, uint32_t stylemask,
|
||||
uint64_t ul, uint64_t ur, uint64_t bl, uint64_t br,
|
||||
int ystop, int xstop){
|
||||
if(check_gradient_args(ul, ur, bl, br)){
|
||||
logerror(n->nc, "Illegal gradient inputs\n");
|
||||
logerror(ncplane_notcurses(n), "Illegal gradient inputs\n");
|
||||
return -1;
|
||||
}
|
||||
if(egc == NULL){
|
||||
@ -217,11 +217,11 @@ int ncplane_gradient(ncplane* n, const char* egc, uint32_t stylemask,
|
||||
ncplane_cursor_yx(n, &yoff, &xoff);
|
||||
// must be at least 1x1, with its upper-left corner at the current cursor
|
||||
if(ystop < yoff){
|
||||
logerror(n->nc, "Ystop %d < yoff %d\n", ystop, yoff);
|
||||
logerror(ncplane_notcurses(n), "Ystop %d < yoff %d\n", ystop, yoff);
|
||||
return -1;
|
||||
}
|
||||
if(xstop < xoff){
|
||||
logerror(n->nc, "Xstop %d < xoff %d\n", xstop, xoff);
|
||||
logerror(ncplane_notcurses(n), "Xstop %d < xoff %d\n", xstop, xoff);
|
||||
return -1;
|
||||
}
|
||||
ncplane_dim_yx(n, &ymax, &xmax);
|
||||
@ -267,18 +267,18 @@ int ncplane_stain(ncplane* n, int ystop, int xstop,
|
||||
uint64_t tl, uint64_t tr, uint64_t bl, uint64_t br){
|
||||
// Can't use default or palette-indexed colors in a gradient
|
||||
if(check_gradient_args(tl, tr, bl, br)){
|
||||
logerror(n->nc, "Illegal staining inputs\n");
|
||||
logerror(ncplane_notcurses(n), "Illegal staining inputs\n");
|
||||
return -1;
|
||||
}
|
||||
int yoff, xoff, ymax, xmax;
|
||||
ncplane_cursor_yx(n, &yoff, &xoff);
|
||||
// must be at least 1x1, with its upper-left corner at the current cursor
|
||||
if(ystop < yoff){
|
||||
logerror(n->nc, "Ystop %d < yoff %d\n", ystop, yoff);
|
||||
logerror(ncplane_notcurses(n), "Ystop %d < yoff %d\n", ystop, yoff);
|
||||
return -1;
|
||||
}
|
||||
if(xstop < xoff){
|
||||
logerror(n->nc, "Xstop %d < xoff %d\n", xstop, xoff);
|
||||
logerror(ncplane_notcurses(n), "Xstop %d < xoff %d\n", xstop, xoff);
|
||||
return -1;
|
||||
}
|
||||
ncplane_dim_yx(n, &ymax, &xmax);
|
||||
@ -345,7 +345,7 @@ rotate_channels(ncplane* src, const cell* c, uint32_t* fchan, uint32_t* bchan){
|
||||
*bchan = *fchan;
|
||||
return 0;
|
||||
}
|
||||
logerror(src->nc, "Invalid EGC for rotation [%s]\n", egc);
|
||||
logerror(ncplane_notcurses(src), "Invalid EGC for rotation [%s]\n", egc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -640,10 +640,10 @@ int ncplane_qrcode(ncplane* n, ncblitter_e blitter, int* ymax, int* xmax,
|
||||
.n = n,
|
||||
.blitter = blitter,
|
||||
};
|
||||
if(ncvisual_render(n->nc, ncv, &vopts) == n){
|
||||
if(ncvisual_render(ncplane_notcurses(n), ncv, &vopts) == n){
|
||||
ret = square;
|
||||
}
|
||||
ncvisual_geom(n->nc, ncv, &vopts, NULL, NULL, &yscale, &xscale);
|
||||
ncvisual_geom(ncplane_notcurses(n), ncv, &vopts, NULL, NULL, &yscale, &xscale);
|
||||
}
|
||||
ncvisual_destroy(ncv);
|
||||
}
|
||||
|
@ -377,12 +377,12 @@ mbstr_find_codepoint(const char* s, char32_t cp, int* col){
|
||||
|
||||
static inline ncplane*
|
||||
ncplane_stdplane(ncplane* n){
|
||||
return notcurses_stdplane(n->nc);
|
||||
return notcurses_stdplane(ncplane_notcurses(n));
|
||||
}
|
||||
|
||||
static inline const ncplane*
|
||||
ncplane_stdplane_const(const ncplane* n){
|
||||
return notcurses_stdplane_const(n->nc);
|
||||
return notcurses_stdplane_const(ncplane_notcurses_const(n));
|
||||
}
|
||||
|
||||
// load all known special keys from terminfo, and build the input sequence trie
|
||||
|
@ -65,7 +65,7 @@ puttext_line(ncplane* n, ncalign_e align, const char* text, size_t* bytes){
|
||||
wchar_t w;
|
||||
const size_t consumed = mbrtowc(&w, text + b, MB_CUR_MAX, &mbstate);
|
||||
if(consumed == (size_t)-2 || consumed == (size_t)-1){
|
||||
logerror(n->nc, "Invalid UTF-8 after %d bytes\n", b);
|
||||
logerror(ncplane_notcurses(n), "Invalid UTF-8 after %d bytes\n", b);
|
||||
return -1;
|
||||
}
|
||||
//fprintf(stderr, "converted [%s] -> %lc\n", text + b, w);
|
||||
|
@ -301,11 +301,11 @@ ncmenu* ncmenu_create(ncplane* n, const ncmenu_options* opts){
|
||||
opts = &zeroed;
|
||||
}
|
||||
if(opts->sectioncount <= 0 || !opts->sections){
|
||||
logerror(n->nc, "Invalid %d-ary section information\n", opts->sectioncount);
|
||||
logerror(ncplane_notcurses(n), "Invalid %d-ary section information\n", opts->sectioncount);
|
||||
return NULL;
|
||||
}
|
||||
if(opts->flags > NCMENU_OPTION_HIDING){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", opts->flags);
|
||||
}
|
||||
int totalheight = 1;
|
||||
int totalwidth = 2; // start with two-character margin on the left
|
||||
@ -313,7 +313,7 @@ ncmenu* ncmenu_create(ncplane* n, const ncmenu_options* opts){
|
||||
ret->sectioncount = opts->sectioncount;
|
||||
ret->sections = NULL;
|
||||
int dimy, dimx;
|
||||
ncplane_dim_yx(notcurses_stdplane(n->nc), &dimy, &dimx);
|
||||
ncplane_dim_yx(notcurses_stdplane(ncplane_notcurses(n)), &dimy, &dimx);
|
||||
if(ret){
|
||||
ret->bottom = !!(opts->flags & NCMENU_OPTION_BOTTOM);
|
||||
if(dup_menu_sections(ret, opts, &totalwidth, &totalheight) == 0){
|
||||
@ -351,7 +351,7 @@ ncmenu* ncmenu_create(ncplane* n, const ncmenu_options* opts){
|
||||
}
|
||||
free(ret);
|
||||
}
|
||||
logerror(n->nc, "Error creating ncmenu");
|
||||
logerror(ncplane_notcurses(n), "Error creating ncmenu");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ int ncmenu_unroll(ncmenu* n, int sectionidx){
|
||||
return -1;
|
||||
}
|
||||
if(sectionidx < 0 || sectionidx >= n->sectioncount){
|
||||
logerror(n->ncp->nc, "Unrolled invalid sectionidx %d\n", sectionidx);
|
||||
logerror(ncplane_notcurses(n->ncp), "Unrolled invalid sectionidx %d\n", sectionidx);
|
||||
return -1;
|
||||
}
|
||||
if(n->sections[sectionidx].enabled_item_count <= 0){
|
||||
|
@ -274,9 +274,9 @@ int update_term_dimensions(int fd, int* rows, int* cols){
|
||||
void free_plane(ncplane* p){
|
||||
if(p){
|
||||
// ncdirect fakes an ncplane with no ->nc
|
||||
if(p->nc){
|
||||
--p->nc->stats.planes;
|
||||
p->nc->stats.fbbytes -= sizeof(*p->fb) * p->leny * p->lenx;
|
||||
if(ncplane_notcurses(p)){
|
||||
--ncplane_notcurses(p)->stats.planes;
|
||||
ncplane_notcurses(p)->stats.fbbytes -= sizeof(*p->fb) * p->leny * p->lenx;
|
||||
}
|
||||
egcpool_dump(&p->pool);
|
||||
free(p->name);
|
||||
@ -352,7 +352,7 @@ ncplane* ncplane_new_internal(notcurses* nc, ncplane* n, const ncplane_options*
|
||||
cell_init(&p->basecell);
|
||||
p->userptr = nopts->userptr;
|
||||
p->above = NULL;
|
||||
if( (p->nc = nc) ){ // every plane associated with a notcurses object
|
||||
if( (p->nc = nc) ){ // every plane has a notcurses object
|
||||
if( (p->below = nc->top) ){ // always happens save initial plane
|
||||
nc->top->above = p;
|
||||
}else{
|
||||
@ -392,7 +392,7 @@ const ncplane* notcurses_stdplane_const(const notcurses* nc){
|
||||
}
|
||||
|
||||
ncplane* ncplane_create(ncplane* n, const ncplane_options* nopts){
|
||||
return ncplane_new_internal(n->nc, n, nopts);
|
||||
return ncplane_new_internal(ncplane_notcurses(n), n, nopts);
|
||||
}
|
||||
|
||||
struct ncplane* ncplane_new(struct ncplane* n, int rows, int cols, int y, int x, void* opaque, const char* name){
|
||||
@ -416,29 +416,29 @@ void ncplane_home(ncplane* n){
|
||||
|
||||
inline int ncplane_cursor_move_yx(ncplane* n, int y, int x){
|
||||
if(x >= n->lenx){
|
||||
logerror(n->nc, "Target x %d >= length %d\n", x, n->lenx);
|
||||
logerror(ncplane_notcurses(n), "Target x %d >= length %d\n", x, n->lenx);
|
||||
return -1;
|
||||
}else if(x < 0){
|
||||
if(x < -1){
|
||||
logerror(n->nc, "Negative target x %d\n", x);
|
||||
logerror(ncplane_notcurses(n), "Negative target x %d\n", x);
|
||||
return -1;
|
||||
}
|
||||
}else{
|
||||
n->x = x;
|
||||
}
|
||||
if(y >= n->leny){
|
||||
logerror(n->nc, "Target y %d >= height %d\n", y, n->leny);
|
||||
logerror(ncplane_notcurses(n), "Target y %d >= height %d\n", y, n->leny);
|
||||
return -1;
|
||||
}else if(y < 0){
|
||||
if(y < -1){
|
||||
logerror(n->nc, "Negative target y %d\n", y);
|
||||
logerror(ncplane_notcurses(n), "Negative target y %d\n", y);
|
||||
return -1;
|
||||
}
|
||||
}else{
|
||||
n->y = y;
|
||||
}
|
||||
if(cursor_invalid_p(n)){
|
||||
logerror(n->nc, "Invalid cursor following move (%d/%d)\n", n->y, n->x);
|
||||
logerror(ncplane_notcurses(n), "Invalid cursor following move (%d/%d)\n", n->y, n->x);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -499,31 +499,31 @@ resize_children(ncplane* n){
|
||||
int ncplane_resize_internal(ncplane* n, int keepy, int keepx, int keepleny,
|
||||
int keeplenx, int yoff, int xoff, int ylen, int xlen){
|
||||
if(keepleny < 0 || keeplenx < 0){ // can't retain negative size
|
||||
logerror(n->nc, "Can't retain negative size %dx%d\n", keepleny, keeplenx);
|
||||
logerror(ncplane_notcurses(n), "Can't retain negative size %dx%d\n", keepleny, keeplenx);
|
||||
return -1;
|
||||
}
|
||||
if((!keepleny && keeplenx) || (keepleny && !keeplenx)){ // both must be 0
|
||||
logerror(n->nc, "Can't retain null dimension %dx%d\n", keepleny, keeplenx);
|
||||
logerror(ncplane_notcurses(n), "Can't retain null dimension %dx%d\n", keepleny, keeplenx);
|
||||
return -1;
|
||||
}
|
||||
// can't be smaller than keep length + abs(offset from keep area)
|
||||
const int yprescribed = keepleny + (yoff < 0 ? -yoff : yoff);
|
||||
if(ylen < yprescribed){
|
||||
logerror(n->nc, "Can't map in y dimension: %d < %d\n", ylen, yprescribed);
|
||||
logerror(ncplane_notcurses(n), "Can't map in y dimension: %d < %d\n", ylen, yprescribed);
|
||||
return -1;
|
||||
}
|
||||
const int xprescribed = keeplenx + (xoff < 0 ? -xoff : xoff);
|
||||
if(xlen < xprescribed){
|
||||
logerror(n->nc, "Can't map in x dimension: %d < %d\n", xlen, xprescribed);
|
||||
logerror(ncplane_notcurses(n), "Can't map in x dimension: %d < %d\n", xlen, xprescribed);
|
||||
return -1;
|
||||
}
|
||||
if(ylen <= 0 || xlen <= 0){ // can't resize to trivial or negative size
|
||||
logerror(n->nc, "Can't achieve meaningless size %dx%d\n", ylen, xlen);
|
||||
logerror(ncplane_notcurses(n), "Can't achieve meaningless size %dx%d\n", ylen, xlen);
|
||||
return -1;
|
||||
}
|
||||
int rows, cols;
|
||||
ncplane_dim_yx(n, &rows, &cols);
|
||||
loginfo(n->nc, "%dx%d @ %d/%d → %d/%d @ %d/%d (keeping %dx%d from %d/%d)\n", rows, cols, n->absy, n->absx, ylen, xlen, n->absy + keepy + yoff, n->absx + keepx + xoff, keepleny, keeplenx, keepy, keepx);
|
||||
loginfo(ncplane_notcurses(n), "%dx%d @ %d/%d → %d/%d @ %d/%d (keeping %dx%d from %d/%d)\n", rows, cols, n->absy, n->absx, ylen, xlen, n->absy + keepy + yoff, n->absx + keepx + xoff, keepleny, keeplenx, keepy, keepx);
|
||||
// we're good to resize. we'll need alloc up a new framebuffer, and copy in
|
||||
// those elements we're retaining, zeroing out the rest. alternatively, if
|
||||
// we've shrunk, we will be filling the new structure.
|
||||
@ -542,8 +542,8 @@ int ncplane_resize_internal(ncplane* n, int keepy, int keepx, int keepleny,
|
||||
n->x = xlen - 1;
|
||||
}
|
||||
cell* preserved = n->fb;
|
||||
n->nc->stats.fbbytes -= sizeof(*preserved) * (rows * cols);
|
||||
n->nc->stats.fbbytes += fbsize;
|
||||
ncplane_notcurses(n)->stats.fbbytes -= sizeof(*preserved) * (rows * cols);
|
||||
ncplane_notcurses(n)->stats.fbbytes += fbsize;
|
||||
n->fb = fb;
|
||||
const int oldabsy = n->absy;
|
||||
// go ahead and move. we can no longer fail at this point. but don't yet
|
||||
@ -601,7 +601,7 @@ int ncplane_resize_internal(ncplane* n, int keepy, int keepx, int keepleny,
|
||||
|
||||
int ncplane_resize(ncplane* n, int keepy, int keepx, int keepleny,
|
||||
int keeplenx, int yoff, int xoff, int ylen, int xlen){
|
||||
if(n == n->nc->stdplane){
|
||||
if(n == ncplane_notcurses(n)->stdplane){
|
||||
//fprintf(stderr, "Can't resize standard plane\n");
|
||||
return -1;
|
||||
}
|
||||
@ -613,19 +613,19 @@ int ncplane_destroy(ncplane* ncp){
|
||||
if(ncp == NULL){
|
||||
return 0;
|
||||
}
|
||||
if(ncp->nc->stdplane == ncp){
|
||||
logerror(ncp->nc, "Won't destroy standard plane\n");
|
||||
if(ncplane_notcurses(ncp)->stdplane == ncp){
|
||||
logerror(ncplane_notcurses(ncp), "Won't destroy standard plane\n");
|
||||
return -1;
|
||||
}
|
||||
if(ncp->above){
|
||||
ncp->above->below = ncp->below;
|
||||
}else{
|
||||
ncp->nc->top = ncp->below;
|
||||
ncplane_notcurses(ncp)->top = ncp->below;
|
||||
}
|
||||
if(ncp->below){
|
||||
ncp->below->above = ncp->above;
|
||||
}else{
|
||||
ncp->nc->bottom = ncp->above;
|
||||
ncplane_notcurses(ncp)->bottom = ncp->above;
|
||||
}
|
||||
if(ncp->bprev){
|
||||
if( (*ncp->bprev = ncp->bnext) ){
|
||||
@ -649,8 +649,8 @@ int ncplane_genocide(ncplane *ncp){
|
||||
if(ncp == NULL){
|
||||
return 0;
|
||||
}
|
||||
if(ncp->nc->stdplane == ncp){
|
||||
logerror(ncp->nc, "Won't destroy standard plane\n");
|
||||
if(ncplane_notcurses(ncp)->stdplane == ncp){
|
||||
logerror(ncplane_notcurses(ncp), "Won't destroy standard plane\n");
|
||||
return -1;
|
||||
}
|
||||
int ret = 0;
|
||||
@ -1253,17 +1253,17 @@ int ncplane_move_above(ncplane* restrict n, ncplane* restrict above){
|
||||
if(n->below){
|
||||
n->below->above = n->above;
|
||||
}else{
|
||||
n->nc->bottom = n->above;
|
||||
ncplane_notcurses(n)->bottom = n->above;
|
||||
}
|
||||
if(n->above){
|
||||
n->above->below = n->below;
|
||||
}else{
|
||||
n->nc->top = n->below;
|
||||
ncplane_notcurses(n)->top = n->below;
|
||||
}
|
||||
if( (n->above = above->above) ){
|
||||
above->above->below = n;
|
||||
}else{
|
||||
n->nc->top = n;
|
||||
ncplane_notcurses(n)->top = n;
|
||||
}
|
||||
above->above = n;
|
||||
n->below = above;
|
||||
@ -1280,17 +1280,17 @@ int ncplane_move_below(ncplane* restrict n, ncplane* restrict below){
|
||||
if(n->below){
|
||||
n->below->above = n->above;
|
||||
}else{
|
||||
n->nc->bottom = n->above;
|
||||
ncplane_notcurses(n)->bottom = n->above;
|
||||
}
|
||||
if(n->above){
|
||||
n->above->below = n->below;
|
||||
}else{
|
||||
n->nc->top = n->below;
|
||||
ncplane_notcurses(n)->top = n->below;
|
||||
}
|
||||
if( (n->below = below->below) ){
|
||||
below->below->above = n;
|
||||
}else{
|
||||
n->nc->bottom = n;
|
||||
ncplane_notcurses(n)->bottom = n;
|
||||
}
|
||||
below->below = n;
|
||||
n->above = below;
|
||||
@ -1303,13 +1303,13 @@ void ncplane_move_top(ncplane* n){
|
||||
if( (n->above->below = n->below) ){
|
||||
n->below->above = n->above;
|
||||
}else{
|
||||
n->nc->bottom = n->above;
|
||||
ncplane_notcurses(n)->bottom = n->above;
|
||||
}
|
||||
n->above = NULL;
|
||||
if( (n->below = n->nc->top) ){
|
||||
if( (n->below = ncplane_notcurses(n)->top) ){
|
||||
n->below->above = n;
|
||||
}
|
||||
n->nc->top = n;
|
||||
ncplane_notcurses(n)->top = n;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1318,13 +1318,13 @@ void ncplane_move_bottom(ncplane* n){
|
||||
if( (n->below->above = n->above) ){
|
||||
n->above->below = n->below;
|
||||
}else{
|
||||
n->nc->top = n->below;
|
||||
ncplane_notcurses(n)->top = n->below;
|
||||
}
|
||||
n->below = NULL;
|
||||
if( (n->above = n->nc->bottom) ){
|
||||
if( (n->above = ncplane_notcurses(n)->bottom) ){
|
||||
n->above->below = n;
|
||||
}
|
||||
n->nc->bottom = n;
|
||||
ncplane_notcurses(n)->bottom = n;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1375,13 +1375,13 @@ ncplane_put(ncplane* n, int y, int x, const char* egc, int cols,
|
||||
// are specified, however, we must always try to print there.
|
||||
if(x != -1){
|
||||
if(x + cols > n->lenx){
|
||||
logerror(n->nc, "Target x %d + %d cols >= length %d\n", x, cols, n->lenx);
|
||||
logerror(ncplane_notcurses(n), "Target x %d + %d cols >= length %d\n", x, cols, n->lenx);
|
||||
ncplane_cursor_move_yx(n, y, x); // update cursor, though
|
||||
return -1;
|
||||
}
|
||||
}else if(y == -1 && n->x + cols > n->lenx){
|
||||
if(!n->scrolling){
|
||||
logerror(n->nc, "No room to output [%.*s] %d/%d\n", bytes, egc, n->y, n->x);
|
||||
logerror(ncplane_notcurses(n), "No room to output [%.*s] %d/%d\n", bytes, egc, n->y, n->x);
|
||||
return -1;
|
||||
}
|
||||
scroll_down(n);
|
||||
@ -1723,17 +1723,17 @@ int ncplane_box(ncplane* n, const cell* ul, const cell* ur,
|
||||
ncplane_cursor_yx(n, &yoff, &xoff);
|
||||
// must be at least 2x2, with its upper-left corner at the current cursor
|
||||
if(ystop < yoff + 1){
|
||||
logerror(n->nc, "ystop (%d) insufficient for yoff (%d)\n", ystop, yoff);
|
||||
logerror(ncplane_notcurses(n), "ystop (%d) insufficient for yoff (%d)\n", ystop, yoff);
|
||||
return -1;
|
||||
}
|
||||
if(xstop < xoff + 1){
|
||||
logerror(n->nc, "xstop (%d) insufficient for xoff (%d)\n", xstop, xoff);
|
||||
logerror(ncplane_notcurses(n), "xstop (%d) insufficient for xoff (%d)\n", xstop, xoff);
|
||||
return -1;
|
||||
}
|
||||
ncplane_dim_yx(n, &ymax, &xmax);
|
||||
// must be within the ncplane
|
||||
if(xstop >= xmax || ystop >= ymax){
|
||||
logerror(n->nc, "Boundary (%dx%d) beyond plane (%dx%d)\n", ystop, xstop, ymax, xmax);
|
||||
logerror(ncplane_notcurses(n), "Boundary (%dx%d) beyond plane (%dx%d)\n", ystop, xstop, ymax, xmax);
|
||||
return -1;
|
||||
}
|
||||
unsigned edges;
|
||||
@ -1852,7 +1852,7 @@ move_bound_planes(ncplane* n, int dy, int dx){
|
||||
}
|
||||
|
||||
int ncplane_move_yx(ncplane* n, int y, int x){
|
||||
if(n == n->nc->stdplane){
|
||||
if(n == ncplane_notcurses(n)->stdplane){
|
||||
return -1;
|
||||
}
|
||||
int dy, dx; // amount moved
|
||||
@ -2063,14 +2063,14 @@ int ncplane_resize_realign(ncplane* n){
|
||||
// is already root of its own stack in this case, we return NULL. If |n| is
|
||||
// already bound to |newparent|, this is a no-op, and we return |n|.
|
||||
ncplane* ncplane_reparent(ncplane* n, ncplane* newparent){
|
||||
if(n == n->nc->stdplane){
|
||||
if(n == ncplane_notcurses(n)->stdplane){
|
||||
return NULL; // can't reparent standard plane
|
||||
}
|
||||
if(n->boundto == n && newparent == NULL){
|
||||
return NULL; // can't make new stack out of a stack's root
|
||||
}
|
||||
if(newparent == NULL){ // FIXME make a new stack
|
||||
newparent = n->nc->stdplane;
|
||||
newparent = ncplane_notcurses(n)->stdplane;
|
||||
}
|
||||
if(n->boundto == newparent){
|
||||
return n;
|
||||
@ -2245,11 +2245,11 @@ uint32_t* ncplane_rgba(const ncplane* nc, ncblitter_e blit,
|
||||
// return a heap-allocated copy of the contents
|
||||
char* ncplane_contents(const ncplane* nc, int begy, int begx, int leny, int lenx){
|
||||
if(begy < 0 || begx < 0){
|
||||
logerror(nc->nc, "Beginning coordinates (%d/%d) below 0\n", begy, begx);
|
||||
logerror(ncplane_notcurses_const(nc), "Beginning coordinates (%d/%d) below 0\n", begy, begx);
|
||||
return NULL;
|
||||
}
|
||||
if(begx >= nc->lenx || begy >= nc->leny){
|
||||
logerror(nc->nc, "Beginning coordinates (%d/%d) exceeded lengths (%d/%d)\n",
|
||||
logerror(ncplane_notcurses_const(nc), "Beginning coordinates (%d/%d) exceeded lengths (%d/%d)\n",
|
||||
begy, begx, nc->leny, nc->lenx);
|
||||
return NULL;
|
||||
}
|
||||
@ -2260,11 +2260,11 @@ char* ncplane_contents(const ncplane* nc, int begy, int begx, int leny, int lenx
|
||||
leny = nc->leny - begy;
|
||||
}
|
||||
if(lenx < 0 || leny < 0){ // no need to draw zero-size object, exit
|
||||
logerror(nc->nc, "Lengths (%d/%d) below 0\n", leny, lenx);
|
||||
logerror(ncplane_notcurses_const(nc), "Lengths (%d/%d) below 0\n", leny, lenx);
|
||||
return NULL;
|
||||
}
|
||||
if(begx + lenx > nc->lenx || begy + leny > nc->leny){
|
||||
logerror(nc->nc, "Ending coordinates (%d/%d) exceeded lengths (%d/%d)\n",
|
||||
logerror(ncplane_notcurses_const(nc), "Ending coordinates (%d/%d) exceeded lengths (%d/%d)\n",
|
||||
begy + leny, begx + lenx, nc->leny, nc->lenx);
|
||||
return NULL;
|
||||
}
|
||||
@ -2307,7 +2307,7 @@ int cells_ascii_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
|
||||
int cells_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl){
|
||||
if(notcurses_canutf8(n->nc)){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n))){
|
||||
return cells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "╔╗╚╝═║");
|
||||
}
|
||||
return cells_ascii_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
|
||||
@ -2315,7 +2315,7 @@ int cells_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
|
||||
int cells_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl){
|
||||
if(notcurses_canutf8(n->nc)){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n))){
|
||||
return cells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "╭╮╰╯─│");
|
||||
}
|
||||
return cells_ascii_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
|
||||
|
@ -21,7 +21,7 @@ class ncppplot {
|
||||
opts = &zeroed;
|
||||
}
|
||||
if(opts->flags > NCPLOT_OPTION_DETECTMAXONLY){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", opts->flags);
|
||||
}
|
||||
//struct notcurses* nc = n->nc;
|
||||
// if miny == maxy (enabling domain detection), they both must be equal to 0
|
||||
|
@ -6,7 +6,7 @@ ncreader* ncreader_create(ncplane* n, const ncreader_options* opts){
|
||||
opts = &zeroed;
|
||||
}
|
||||
if(opts->flags > NCREADER_OPTION_CURSOR){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", opts->flags);
|
||||
}
|
||||
ncreader* nr = malloc(sizeof(*nr));
|
||||
if(nr == NULL){
|
||||
@ -73,7 +73,7 @@ ncreader_redraw(ncreader* n){
|
||||
}
|
||||
}
|
||||
}
|
||||
if(notcurses_cursor_enable(n->ncp->nc, n->ncp->absy + n->ncp->y, n->ncp->absx + n->ncp->x)){
|
||||
if(notcurses_cursor_enable(ncplane_notcurses(n->ncp), n->ncp->absy + n->ncp->y, n->ncp->absx + n->ncp->x)){
|
||||
ret = -1;
|
||||
}
|
||||
return ret;
|
||||
@ -187,7 +187,7 @@ int ncreader_move_down(ncreader* n){
|
||||
int ncreader_write_egc(ncreader* n, const char* egc){
|
||||
const int cols = ncstrwidth(egc);
|
||||
if(cols < 0){
|
||||
logerror(n->ncp->nc, "Fed illegal UTF-8 [%s]\n", egc);
|
||||
logerror(ncplane_notcurses(n->ncp), "Fed illegal UTF-8 [%s]\n", egc);
|
||||
return -1;
|
||||
}
|
||||
if(n->textarea->x >= n->textarea->lenx - cols){
|
||||
@ -387,7 +387,7 @@ void ncreader_destroy(ncreader* n, char** contents){
|
||||
*contents = ncreader_contents(n);
|
||||
}
|
||||
if(n->manage_cursor){
|
||||
notcurses_cursor_disable(n->ncp->nc);
|
||||
notcurses_cursor_disable(ncplane_notcurses(n->ncp));
|
||||
}
|
||||
ncplane_destroy(n->textarea);
|
||||
ncplane_destroy(n->ncp);
|
||||
|
@ -304,7 +304,7 @@ ncreel_draw_tablet(const ncreel* nr, nctablet* t, int frontiertop,
|
||||
int ll = t->cbfxn(t, direction == DIRECTION_DOWN);
|
||||
//fprintf(stderr, "RETURNRETURNRETURN %p %d (%d, %d, %d) DIR %d\n", t, ll, cby, cbleny, leny, direction);
|
||||
if(ll > cbleny){
|
||||
logwarn(nr->p->nc, "Tablet callback returned %d lines, %d allowed\n", ll, cbleny);
|
||||
logwarn(ncplane_notcurses(nr->p), "Tablet callback returned %d lines, %d allowed\n", ll, cbleny);
|
||||
ll = cbleny;
|
||||
}
|
||||
if(ll != cbleny){
|
||||
@ -668,7 +668,7 @@ int ncreel_redraw(ncreel* nr){
|
||||
if(focused){
|
||||
//fprintf(stderr, "drawing focused tablet %p dir: %d fulcrum: %d!\n", focused, nr->direction, fulcrum);
|
||||
if(ncreel_draw_tablet(nr, focused, fulcrum, fulcrum, DIRECTION_DOWN)){
|
||||
logerror(nr->p->nc, "Error drawing tablet\n");
|
||||
logerror(ncplane_notcurses(nr->p), "Error drawing tablet\n");
|
||||
return -1;
|
||||
}
|
||||
//fprintf(stderr, "drew focused tablet %p -> %p lastdir: %d!\n", focused, focused->p, nr->direction);
|
||||
@ -680,33 +680,33 @@ int ncreel_redraw(ncreel* nr){
|
||||
if(nr->direction == LASTDIRECTION_DOWN){
|
||||
otherend = draw_previous_tablets(nr, otherend, &frontiertop, frontierbottom);
|
||||
if(otherend == NULL){
|
||||
logerror(nr->p->nc, "Error drawing higher tablets\n");
|
||||
logerror(ncplane_notcurses(nr->p), "Error drawing higher tablets\n");
|
||||
return -1;
|
||||
}
|
||||
otherend = draw_following_tablets(nr, otherend, frontiertop, &frontierbottom);
|
||||
}else{ // DIRECTION_UP
|
||||
otherend = draw_previous_tablets(nr, otherend, &frontiertop, frontierbottom);
|
||||
if(otherend == NULL){
|
||||
logerror(nr->p->nc, "Error drawing higher tablets\n");
|
||||
logerror(ncplane_notcurses(nr->p), "Error drawing higher tablets\n");
|
||||
return -1;
|
||||
}
|
||||
otherend = draw_following_tablets(nr, otherend, frontiertop, &frontierbottom);
|
||||
}
|
||||
if(otherend == NULL){
|
||||
logerror(nr->p->nc, "Error drawing following tablets\n");
|
||||
logerror(ncplane_notcurses(nr->p), "Error drawing following tablets\n");
|
||||
return -1;
|
||||
}
|
||||
//notcurses_debug(nr->p->nc, stderr);
|
||||
//notcurses_debug(ncplane_notcurses(nr->p), stderr);
|
||||
if(tighten_reel(nr)){
|
||||
logerror(nr->p->nc, "Error tightening reel\n");
|
||||
logerror(ncplane_notcurses(nr->p), "Error tightening reel\n");
|
||||
return -1;
|
||||
}
|
||||
//notcurses_debug(nr->p->nc, stderr);
|
||||
//notcurses_debug(ncplane_notcurses(nr->p), stderr);
|
||||
}
|
||||
nr->vft = nr->tablets; // update the visually-focused tablet pointer
|
||||
//fprintf(stderr, "DONE ARRANGING\n");
|
||||
if(draw_ncreel_borders(nr)){
|
||||
logerror(nr->p->nc, "Error drawing reel borders\n");
|
||||
logerror(ncplane_notcurses(nr->p), "Error drawing reel borders\n");
|
||||
return -1; // enforces specified dimensional minima
|
||||
}
|
||||
return 0;
|
||||
@ -718,7 +718,7 @@ validate_ncreel_opts(ncplane* n, const ncreel_options* ropts){
|
||||
return false;
|
||||
}
|
||||
if(ropts->flags > NCREEL_OPTION_CIRCULAR){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", ropts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", ropts->flags);
|
||||
}
|
||||
if(ropts->flags & NCREEL_OPTION_CIRCULAR){
|
||||
if(!(ropts->flags & NCREEL_OPTION_INFINITESCROLL)){
|
||||
@ -782,7 +782,7 @@ nctablet* ncreel_add(ncreel* nr, nctablet* after, nctablet *before,
|
||||
nctablet* t;
|
||||
if(after && before){
|
||||
if(after->prev != before || before->next != after){
|
||||
logerror(nr->p->nc, "bad before (%p) / after (%p) spec\n", before, after);
|
||||
logerror(ncplane_notcurses(nr->p), "bad before (%p) / after (%p) spec\n", before, after);
|
||||
return NULL;
|
||||
}
|
||||
}else if(!after && !before){
|
||||
|
@ -146,7 +146,7 @@ void cell_release(ncplane* n, cell* c){
|
||||
// Duplicate one cell onto another when they share a plane. Convenience wrapper.
|
||||
int cell_duplicate(ncplane* n, cell* targ, const cell* c){
|
||||
if(cell_duplicate_far(&n->pool, targ, n, c) < 0){
|
||||
logerror(n->nc, "Failed duplicating cell");
|
||||
logerror(ncplane_notcurses(n), "Failed duplicating cell");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -411,22 +411,22 @@ int ncplane_mergedown(const ncplane* restrict src, ncplane* restrict dst,
|
||||
int dsty, int dstx){
|
||||
//fprintf(stderr, "Merging down %d/%d @ %d/%d to %d/%d\n", leny, lenx, begsrcy, begsrcx, dsty, dstx);
|
||||
if(dsty >= dst->leny || dstx >= dst->lenx){
|
||||
logerror(dst->nc, "Dest origin %d/%d ≥ dest dimensions %d/%d\n",
|
||||
logerror(ncplane_notcurses(dst), "Dest origin %d/%d ≥ dest dimensions %d/%d\n",
|
||||
dsty, dstx, dst->leny, dst->lenx);
|
||||
return -1;
|
||||
}
|
||||
if(dst->leny - leny < dsty || dst->lenx - lenx < dstx){
|
||||
logerror(dst->nc, "Dest len %d/%d ≥ dest dimensions %d/%d\n",
|
||||
logerror(ncplane_notcurses(dst), "Dest len %d/%d ≥ dest dimensions %d/%d\n",
|
||||
leny, lenx, dst->leny, dst->lenx);
|
||||
return -1;
|
||||
}
|
||||
if(begsrcy >= src->leny || begsrcx >= src->lenx){
|
||||
logerror(dst->nc, "Source origin %d/%d ≥ source dimensions %d/%d\n",
|
||||
logerror(ncplane_notcurses(dst), "Source origin %d/%d ≥ source dimensions %d/%d\n",
|
||||
begsrcy, begsrcx, src->leny, src->lenx);
|
||||
return -1;
|
||||
}
|
||||
if(src->leny - leny < begsrcy || src->lenx - lenx < begsrcx){
|
||||
logerror(dst->nc, "Source len %d/%d ≥ source dimensions %d/%d\n",
|
||||
logerror(ncplane_notcurses(dst), "Source len %d/%d ≥ source dimensions %d/%d\n",
|
||||
leny, lenx, src->leny, src->lenx);
|
||||
return -1;
|
||||
}
|
||||
@ -435,7 +435,7 @@ int ncplane_mergedown(const ncplane* restrict src, ncplane* restrict dst,
|
||||
const size_t crenderlen = sizeof(struct crender) * totalcells;
|
||||
struct crender* rvec = malloc(crenderlen);
|
||||
if(!rendfb || !rvec){
|
||||
logerror(dst->nc, "Error allocating render state for %dx%d\n", leny, lenx);
|
||||
logerror(ncplane_notcurses(dst), "Error allocating render state for %dx%d\n", leny, lenx);
|
||||
free(rendfb);
|
||||
free(rvec);
|
||||
return -1;
|
||||
@ -453,7 +453,7 @@ int ncplane_mergedown(const ncplane* restrict src, ncplane* restrict dst,
|
||||
}
|
||||
|
||||
int ncplane_mergedown_simple(const ncplane* restrict src, ncplane* restrict dst){
|
||||
notcurses* nc = src->nc;
|
||||
const notcurses* nc = ncplane_notcurses_const(src);
|
||||
if(dst == NULL){
|
||||
dst = nc->stdplane;
|
||||
}
|
||||
|
@ -103,20 +103,20 @@ ncselector_draw(ncselector* n){
|
||||
ncplane_rounded_box_sized(n->ncp, 0, n->boxchannels, dimy - yoff, bodywidth, 0);
|
||||
if(n->title){
|
||||
n->ncp->channels = n->boxchannels;
|
||||
if(notcurses_canutf8(n->ncp->nc)){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n->ncp))){
|
||||
ncplane_putegc_yx(n->ncp, 2, dimx - 1, "┤", NULL);
|
||||
}else{
|
||||
ncplane_putchar_yx(n->ncp, 2, dimx - 1, '|');
|
||||
}
|
||||
if(bodywidth < dimx){
|
||||
if(notcurses_canutf8(n->ncp->nc)){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n->ncp))){
|
||||
ncplane_putegc_yx(n->ncp, 2, dimx - bodywidth, "┬", NULL);
|
||||
}else{
|
||||
ncplane_putchar_yx(n->ncp, 2, dimx - bodywidth, '-');
|
||||
}
|
||||
}
|
||||
if((n->titlecols + 4 != dimx) && n->titlecols > n->secondarycols){
|
||||
if(notcurses_canutf8(n->ncp->nc)){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n->ncp))){
|
||||
ncplane_putegc_yx(n->ncp, 2, dimx - (n->titlecols + 4), "┴", NULL);
|
||||
}else{
|
||||
ncplane_putchar_yx(n->ncp, 2, dimx - (n->titlecols + 4), '-');
|
||||
@ -152,7 +152,7 @@ ncselector_draw(ncselector* n){
|
||||
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
||||
n->ncp->channels = n->descchannels;
|
||||
n->arrowx = bodyoffset + n->longop;
|
||||
if(notcurses_canutf8(n->ncp->nc)){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n->ncp))){
|
||||
ncplane_putegc_yx(n->ncp, yoff, n->arrowx, "↑", NULL);
|
||||
}else{
|
||||
ncplane_putchar_yx(n->ncp, yoff, n->arrowx, '<');
|
||||
@ -195,7 +195,7 @@ ncselector_draw(ncselector* n){
|
||||
}
|
||||
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
||||
n->ncp->channels = n->descchannels;
|
||||
if(notcurses_canutf8(n->ncp->nc)){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n->ncp))){
|
||||
ncplane_putegc_yx(n->ncp, yoff, n->arrowx, "↓", NULL);
|
||||
}else{
|
||||
ncplane_putchar_yx(n->ncp, yoff, n->arrowx, '>');
|
||||
@ -238,7 +238,7 @@ ncselector* ncselector_create(ncplane* n, const ncselector_options* opts){
|
||||
}
|
||||
unsigned itemcount = 0;
|
||||
if(opts->flags > 0){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", opts->flags);
|
||||
}
|
||||
if(opts->items){
|
||||
for(const struct ncselector_item* i = opts->items ; i->option ; ++i){
|
||||
@ -653,7 +653,7 @@ ncmultiselector_draw(ncmultiselector* n){
|
||||
if(printidx == n->current){
|
||||
n->ncp->channels = (uint64_t)channels_bchannel(n->descchannels) << 32u | channels_fchannel(n->descchannels);
|
||||
}
|
||||
if(notcurses_canutf8(n->ncp->nc)){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n->ncp))){
|
||||
ncplane_putegc_yx(n->ncp, yoff, bodyoffset, n->items[printidx].selected ? "☒" : "☐", NULL);
|
||||
}else{
|
||||
ncplane_putchar_yx(n->ncp, yoff, bodyoffset, n->items[printidx].selected ? 'X' : '-');
|
||||
@ -833,7 +833,7 @@ ncmultiselector* ncmultiselector_create(ncplane* n, const ncmultiselector_option
|
||||
opts = &zeroed;
|
||||
}
|
||||
if(opts->flags > 0){
|
||||
logwarn(n->nc, "Provided unsupported flags %016lx\n", opts->flags);
|
||||
logwarn(ncplane_notcurses(n), "Provided unsupported flags %016lx\n", opts->flags);
|
||||
}
|
||||
unsigned itemcount = 0;
|
||||
if(opts->items){
|
||||
|
Loading…
x
Reference in New Issue
Block a user