death to horiz #1115

This commit is contained in:
nick black 2020-11-14 21:42:37 -05:00 committed by Nick Black
parent 719ed0658a
commit eef6df8c0a
39 changed files with 180 additions and 173 deletions

View File

@ -2,6 +2,9 @@ This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 2.0.5 (not yet released)
* The `horiz` union of `ncplane_options` has been discarded; the `int x`
within has been promoted. This union brought no actual type safety, and was
annoying for callers to deal with otherwise. Sorry for the inconvenience.
* As promised, `ncplane_new()` has been marked as deprecated. It will be
removed in 3.0. Use the strictly more powerful `ncplane_create()` instead,
with its self-documenting `struct ncplane_options` argument. So long as

View File

@ -71,9 +71,7 @@ namespace ncpp
{
struct ncplane_options nopts = {
.y = yoff,
.horiz = {
.x = xoff,
},
.x = xoff,
.rows = rows,
.cols = cols,
.userptr = opaque,
@ -1174,9 +1172,7 @@ namespace ncpp
{
struct ncplane_options nopts = {
.y = yoff,
.horiz = {
.x = xoff,
},
.x = xoff,
.rows = rows,
.cols = cols,
.userptr = opaque,

View File

@ -1028,10 +1028,7 @@ API char* notcurses_at_yx(struct notcurses* nc, int yoff, int xoff,
typedef struct ncplane_options {
int y; // vertical placement relative to parent plane
union {
int x;
ncalign_e align;
} horiz; // horizontal placement relative to parent plane
int x; // horizontal placement relative to parent plane
int rows; // number of rows, must be positive
int cols; // number of columns, must be positive
void* userptr; // user curry, may be NULL

View File

@ -102,9 +102,7 @@ int allglyphs_demo(struct notcurses* nc){
const int planey = (dimy - height) / 2 + 1;
ncplane_options nopts = {
.y = planey,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.rows = height,
.cols = width,
.flags = NCPLANE_OPTION_HORALIGNED,

View File

@ -95,9 +95,7 @@ debug_toggle(struct notcurses* nc){
}
ncplane_options nopts = {
.y = 3,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.rows = count_debug_lines(output, outputlen) + 1,
.cols = dimx + 1, // so we don't break lines before the true boundary
.flags = NCPLANE_OPTION_HORALIGNED,
@ -138,9 +136,7 @@ about_toggle(struct notcurses* nc){
notcurses_term_dim_yx(nc, &dimy, NULL);
ncplane_options nopts = {
.y = 3,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.rows = ABOUT_ROWS,
.cols = ABOUT_COLS,
.flags = NCPLANE_OPTION_HORALIGNED,
@ -395,8 +391,17 @@ struct ncplane* hud_create(struct notcurses* nc){
int dimx, dimy;
notcurses_term_dim_yx(nc, &dimy, &dimx);
int yoffset = dimy - HUD_ROWS;
struct ncplane* n = ncplane_new(notcurses_stdplane(nc), HUD_ROWS, HUD_COLS,
yoffset, 7, NULL, "hud");
struct ncplane_options nopts = {
.y = yoffset,
.x = 7,
.rows = HUD_ROWS,
.cols = HUD_COLS,
.userptr = NULL,
.name = "hud",
.resizecb = NULL,
.flags = 0,
};
struct ncplane* n = ncplane_create(notcurses_stdplane(nc), &nopts);
if(n == NULL){
return NULL;
}
@ -608,9 +613,7 @@ int fpsgraph_init(struct notcurses* nc){
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
ncplane_options nopts = {
.y = dimy - PLOTHEIGHT,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.rows = PLOTHEIGHT,
.cols = dimx,
.userptr = NULL,

View File

@ -3393,9 +3393,7 @@ static struct ncplane*
mojiplane(struct ncplane* title, int y, int rows, const char* summary){
ncplane_options nopts = {
.y = y,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.rows = rows,
.cols = planewidth,
.flags = NCPLANE_OPTION_HORALIGNED,
@ -3559,9 +3557,7 @@ struct ncplane*
maketitle(struct ncplane* std){
ncplane_options nopts = {
.y = 2,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.rows = 3,
.cols = 74,
.flags = NCPLANE_OPTION_HORALIGNED,

View File

@ -115,9 +115,7 @@ outro_message(struct notcurses* nc, int* rows, int* cols){
.rows = 5,
.cols = strlen(str1) + 4,
.y = ystart,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.flags = NCPLANE_OPTION_HORALIGNED,
};
struct ncplane* non = ncplane_create(notcurses_stdplane(nc), &nopts);

View File

@ -32,9 +32,7 @@ legend(struct notcurses* nc, const char* msg){
.rows = 3,
.cols = strlen(msg) + 4,
.y = 3,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.flags = NCPLANE_OPTION_HORALIGNED,
};
struct ncplane* n = ncplane_create(notcurses_stdplane(nc), &nopts);

View File

@ -183,9 +183,7 @@ int unicodeblocks_demo(struct notcurses* nc){
ns_to_timespec(nstotal / 5, &subdelay);
ncplane_options nopts = {
.y = 2,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.rows = 2,
.cols = (CHUNKSIZE * 2) - 2,
.flags = NCPLANE_OPTION_HORALIGNED,

View File

@ -77,7 +77,14 @@ multiselector_demo(struct ncplane* n, struct ncplane* under, int y){
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0x40, 0, 0, 0x40, 0);
channels_set_fg_alpha(&bgchannels, CELL_ALPHA_BLEND);
channels_set_bg_alpha(&bgchannels, CELL_ALPHA_BLEND);
struct ncplane* mseln = ncplane_new(n, 1, 1, y, 0, NULL, NULL);
struct ncplane_options nopts = {
.y = y,
.x = 0,
.rows = 1,
.cols = 1,
NULL, NULL, NULL, 0,
};
struct ncplane* mseln = ncplane_create(n, &nopts);
if(mseln == NULL){
return NULL;
}
@ -107,7 +114,14 @@ selector_demo(struct ncplane* n, struct ncplane* under, int dimx, int y){
uint64_t bgchannels = CHANNELS_RGB_INITIALIZER(0, 0, 0x40, 0, 0, 0x40);
channels_set_fg_alpha(&bgchannels, CELL_ALPHA_BLEND);
channels_set_bg_alpha(&bgchannels, CELL_ALPHA_BLEND);
struct ncplane* seln = ncplane_new(n, 1, 1, y, dimx, NULL, NULL);
struct ncplane_options nopts = {
.y = y,
.x = dimx,
.rows = 1,
.cols = 1,
NULL, NULL, NULL, 0,
};
struct ncplane* seln = ncplane_create(n, &nopts);
if(seln == NULL){
return NULL;
}
@ -369,7 +383,7 @@ reader_demo(struct notcurses* nc){
struct ncplane* std = notcurses_stddim_yx(nc, &dimy, &dimx);
const int READER_COLS = 64;
const int READER_ROWS = 8;
ncreader_options nopts = {
ncreader_options ropts = {
.tchannels = CHANNELS_RGB_INITIALIZER(0xa0, 0xe0, 0xe0, 0, 0, 0),
};
uint64_t echannels = CHANNELS_RGB_INITIALIZER(0x20, 0xe0, 0xe0, 0, 0, 0);
@ -377,9 +391,20 @@ reader_demo(struct notcurses* nc){
const int x = ncplane_align(std, NCALIGN_CENTER, READER_COLS);
struct ncselector* selector = NULL;
struct ncmultiselector* mselector = NULL;
struct ncplane* rp = ncplane_new(std, READER_ROWS, READER_COLS, dimy, x, NULL, "read");
struct ncreader* reader = NULL;
struct ncplane_options nopts = {
.y = dimy,
.x = x,
.rows = READER_ROWS,
.cols = READER_COLS,
NULL, "read", NULL, 0,
};
struct ncplane* rp = ncplane_create(std, &nopts);
if(rp == NULL){
goto done;
}
ncplane_set_base(rp, " ", 0, echannels);
struct ncreader* reader = ncreader_create(rp, &nopts);
reader = ncreader_create(rp, &ropts);
if(reader == NULL){
goto done;
}

View File

@ -319,7 +319,7 @@ infoplane(struct ncdirect* ncd, const fetched_info* fi){
struct ncplane* std = notcurses_stddim_yx(nc, &dimy, NULL);
struct ncplane_options nopts = {
.y = dimy - planeheight,
.horiz.align = NCALIGN_CENTER,
.x = NCALIGN_CENTER,
.rows = planeheight,
.cols = planewidth,
.userptr = NULL,

View File

@ -444,9 +444,7 @@ int ncdirect_render_image(ncdirect* n, const char* file, ncalign_e align,
//fprintf(stderr, "render: %d+%d of %d/%d stride %u %p\n", leny, lenx, ncv->rows, ncv->cols, ncv->rowstride, ncv->data);
ncplane_options nopts = {
.y = 0,
.horiz = {
.x = 0,
},
.x = 0,
.rows = disprows / encoding_y_scale(bset),
.cols = dispcols / encoding_x_scale(bset),
.userptr = nullptr,

View File

@ -489,7 +489,7 @@ rotate_plane(ncplane* n){
const int newx = dimy * 2;
struct ncplane_options nopts = {
.y = absy,
.horiz.x = absx,
.x = absx,
.rows = newy,
.cols = newx,
.userptr = n->userptr,

View File

@ -323,7 +323,7 @@ ncmenu* ncmenu_create(ncplane* n, const ncmenu_options* opts){
}
struct ncplane_options nopts = {
.y = ret->bottom ? dimy - totalheight : 0,
.horiz.x = 0,
.x = 0,
.rows = totalheight,
.cols = totalwidth,
.name = "menu",

View File

@ -323,10 +323,10 @@ ncplane* ncplane_new_internal(notcurses* nc, ncplane* n, const ncplane_options*
p->align = NCALIGN_UNALIGNED;
if( (p->boundto = n) ){
if(nopts->flags & NCPLANE_OPTION_HORALIGNED){
p->absx = ncplane_align(n, nopts->horiz.align, nopts->cols);
p->align = nopts->horiz.align;
p->absx = ncplane_align(n, nopts->x, nopts->cols);
p->align = nopts->x;
}else{
p->absx = nopts->horiz.x;
p->absx = nopts->x;
}
p->absx += n->absx;
p->absy = nopts->y + n->absy;
@ -338,7 +338,7 @@ ncplane* ncplane_new_internal(notcurses* nc, ncplane* n, const ncplane_options*
}else{ // new standard plane
assert(!(nopts->flags & NCPLANE_OPTION_HORALIGNED));
assert(0 == nopts->y);
assert(0 == nopts->horiz.x);
assert(0 == nopts->x);
p->absx = (nc ? nc->margin_l : 0);
p->absy = (nc ? nc->margin_t : 0);
p->bnext = NULL;
@ -375,9 +375,7 @@ static ncplane*
create_initial_ncplane(notcurses* nc, int dimy, int dimx){
ncplane_options nopts = {
.y = 0,
.horiz = {
.x = 0,
},
.x = 0,
.rows = dimy - (nc->margin_t + nc->margin_b),
.cols = dimx - (nc->margin_l + nc->margin_r),
.name = "std",
@ -400,9 +398,7 @@ ncplane* ncplane_create(ncplane* n, const ncplane_options* nopts){
struct ncplane* ncplane_new(struct ncplane* n, int rows, int cols, int y, int x, void* opaque, const char* name){
ncplane_options nopts = {
.y = y,
.horiz = {
.x = x,
},
.x = x,
.rows = rows,
.cols = cols,
.userptr = opaque,
@ -459,7 +455,7 @@ ncplane* ncplane_dup(const ncplane* n, void* opaque){
const int placex = n->absx - nc->margin_l;
struct ncplane_options nopts = {
.y = placey,
.horiz.x = placex,
.x = placex,
.rows = dimy,
.cols = dimx,
.userptr = opaque,

View File

@ -18,7 +18,7 @@ ncreader* ncreader_create(ncplane* n, const ncreader_options* opts){
// to the upper left of the true origin
struct ncplane_options nopts = {
.y = -ncplane_dim_y(n),
.horiz.x = -ncplane_dim_x(n),
.x = -ncplane_dim_x(n),
.rows = ncplane_dim_y(n),
.cols = ncplane_dim_x(n),
.name = "text",

View File

@ -260,7 +260,7 @@ ncreel_draw_tablet(const ncreel* nr, nctablet* t, int frontiertop,
//fprintf(stderr, "p tplacement: %p base %d/%d len %d/%d frontiery %d %d dir %d\n", t, begy, begx, leny, lenx, frontiertop, frontierbottom, direction);
struct ncplane_options nopts = {
.y = begy,
.horiz.x = begx,
.x = begx,
.rows = leny,
.cols = lenx,
.name = "tab",
@ -287,7 +287,7 @@ ncreel_draw_tablet(const ncreel* nr, nctablet* t, int frontiertop,
//fprintf(stderr, "cbp placement %dx%d @ %dx%d\n", cbleny, cblenx, cby, cbx);
struct ncplane_options dnopts = {
.y = cby,
.horiz.x = cbx,
.x = cbx,
.rows = cbleny,
.cols = cblenx,
.name = "tdat",

View File

@ -420,9 +420,7 @@ auto ncvisual_render(notcurses* nc, ncvisual* ncv,
//fprintf(stderr, "PLACING NEW PLANE: %d/%d @ %d/%d\n", disprows, dispcols, placey, placex);
struct ncplane_options nopts = {
.y = placey,
.horiz = {
.x = placex,
},
.x = placex,
.rows = disprows / encoding_y_scale(bset),
.cols = dispcols / encoding_x_scale(bset),
.userptr = nullptr,

View File

@ -8,9 +8,7 @@ static int
run_menu(struct notcurses* nc, struct ncmenu* ncm){
ncplane_options nopts = {
.y = 10,
.horiz = {
.align = NCALIGN_CENTER,
},
.x = NCALIGN_CENTER,
.rows = 3,
.cols = 40,
.flags = NCPLANE_OPTION_HORALIGNED,

View File

@ -108,7 +108,7 @@ int main(void){
ncplane_putstr_aligned(n, 0, NCALIGN_RIGHT, "multiselect widget demo");
struct ncplane_options nopts = {
.y = 3,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
.userptr = NULL,

View File

@ -28,16 +28,25 @@ auto main(int argc, const char** argv) -> int {
}else if(argc > 2){
usage(argv[0], EXIT_FAILURE);
}
notcurses_options nopts{};
nopts.flags = NCOPTION_INHIBIT_SETLOCALE;
NotCurses nc(nopts);
notcurses_options ncopts{};
ncopts.flags = NCOPTION_INHIBIT_SETLOCALE;
NotCurses nc(ncopts);
int dimy, dimx;
auto n = std::make_unique<Plane *>(nc.get_stdplane(&dimy, &dimx));
nc.get_term_dim(&dimy, &dimx);
ncreader_options opts{};
opts.flags = NCREADER_OPTION_CURSOR | (horscroll ? NCREADER_OPTION_HORSCROLL : 0);
// can't use Plane until we have move constructor for Reader
struct ncplane* rp = ncplane_new(**n, dimy / 8, dimx / 2, 2, 2, nullptr, "read");
struct ncplane_options nopts = {
.y = 2,
.x = 2,
.rows = dimy / 8,
.cols = dimx / 2,
.userptr = nullptr,
.name = "read",
nullptr, 0,
};
struct ncplane* rp = ncplane_create(**n, &nopts);
ncplane_set_base(rp, "", 0, 0);
auto nr = ncreader_create(rp, &opts);
if(nr == nullptr){
@ -68,7 +77,7 @@ auto main(int argc, const char** argv) -> int {
ncreader_destroy(nr, &contents);
//nc.stop();
if(contents){
printf("\n input: %s\n", contents);
fprintf(stderr, "\n input: %s\n", contents);
}
return EXIT_SUCCESS;
}

View File

@ -207,7 +207,7 @@ int main(int argc, char** argv){
}
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 0, },
.x = 0,
.rows = dimy - 1,
.cols = dimx,
.userptr = nullptr,

View File

@ -100,7 +100,7 @@ int main(void){
ncplane_putstr_aligned(n, 0, NCALIGN_RIGHT, "selector widget demo");
struct ncplane_options nopts = {
.y = 3,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
.userptr = NULL,

View File

@ -86,7 +86,7 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
ncplane_dim_yx(vopts->n, &dimy, &dimx);
struct ncplane_options nopts = {
.y = dimy - 1,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = dimx,
nullptr, "subt", nullptr, 0,

View File

@ -16,9 +16,7 @@ TEST_CASE("Blitting") {
};
struct ncplane_options nopts = {
.y = 0,
.horiz = {
.x = 0,
},
.x = 0,
.rows = 2,
.cols = 4,
.userptr = nullptr,
@ -66,9 +64,7 @@ TEST_CASE("Blitting") {
};
struct ncplane_options nopts = {
.y = 0,
.horiz = {
.x = 0,
},
.x = 0,
.rows = 2,
.cols = 4,
.userptr = nullptr,

View File

@ -154,7 +154,7 @@ TEST_CASE("Cell") {
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT));
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
.userptr = nullptr,
@ -193,7 +193,7 @@ TEST_CASE("Cell") {
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT));
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
.userptr = nullptr,
@ -232,7 +232,7 @@ TEST_CASE("Cell") {
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT));
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
.userptr = nullptr,
@ -271,7 +271,7 @@ TEST_CASE("Cell") {
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT));
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
.userptr = nullptr,
@ -311,7 +311,7 @@ TEST_CASE("Cell") {
CHECK(0 == cell_set_fg_alpha(&c, CELL_ALPHA_TRANSPARENT));
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
.userptr = nullptr,

View File

@ -36,7 +36,7 @@ TEST_CASE("Fills") {
cell c = CELL_CHAR_INITIALIZER('+');
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 4,
.cols = 4,
.userptr = nullptr,
@ -68,7 +68,7 @@ TEST_CASE("Fills") {
cell c = CELL_CHAR_INITIALIZER('+');
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 20,
.cols = 20,
.userptr = nullptr,
@ -87,7 +87,7 @@ TEST_CASE("Fills") {
cell c = CELL_CHAR_INITIALIZER('+');
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 4,
.cols = 4,
.userptr = nullptr,
@ -358,7 +358,7 @@ TEST_CASE("Fills") {
SUBCASE("MergeDownASCII") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 10,
.userptr = nullptr,
@ -402,7 +402,7 @@ TEST_CASE("Fills") {
SUBCASE("MergeDownUni") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 10,
.userptr = nullptr,
@ -456,7 +456,7 @@ TEST_CASE("Fills") {
constexpr int DIMY = 10;
struct ncplane_options nopts = {
.y = 2,
.horiz = { .x = 2, },
.x = 2,
.rows = DIMY,
.cols = DIMX,
.userptr = nullptr,
@ -474,7 +474,7 @@ TEST_CASE("Fills") {
CHECK(0 == notcurses_render(nc_));
struct ncplane_options n2opts = {
.y = 3,
.horiz = { .x = 3, },
.x = 3,
.rows = DIMY / 2,
.cols = DIMX / 2,
.userptr = nullptr,
@ -515,7 +515,7 @@ TEST_CASE("Fills") {
constexpr int DIMY = 10;
struct ncplane_options nopts = {
.y = 2,
.horiz = { .x = 2, },
.x = 2,
.rows = DIMY,
.cols = DIMX,
.userptr = nullptr,
@ -533,7 +533,7 @@ TEST_CASE("Fills") {
CHECK(0 == notcurses_render(nc_));
struct ncplane_options n2opts = {
.y = 3,
.horiz = { .x = 3, },
.x = 3,
.rows = DIMY / 2,
.cols = DIMX / 2,
.userptr = nullptr,

View File

@ -26,7 +26,7 @@ TEST_CASE("Geometry") {
for(t = tests ; !t->leny ; ++t){
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = t->leny,
.cols = t->lenx,
.userptr = nullptr,
@ -72,7 +72,7 @@ TEST_CASE("Geometry") {
for(t = tests ; !t->leny ; ++t){
struct ncplane_options nopts = {
.y = t->absy,
.horiz = { .x = t->absx, },
.x = t->absx,
.rows = t->leny,
.cols = t->lenx,
.userptr = nullptr,

View File

@ -14,7 +14,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutLeft") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 20,
.userptr = nullptr,
@ -38,7 +38,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutRight") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 20,
.userptr = nullptr,
@ -62,7 +62,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutCenter") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 20,
.userptr = nullptr,
@ -87,7 +87,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutOnBoundary") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 10,
.userptr = nullptr,
@ -113,7 +113,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutCrossBoundary") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 10,
.userptr = nullptr,
@ -139,7 +139,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutNewlines") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 5,
.cols = 5,
.userptr = nullptr,
@ -165,7 +165,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutNewlinesAtBorders") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 5,
.cols = 3,
.userptr = nullptr,
@ -192,7 +192,7 @@ TEST_CASE("TextLayout") {
if(enforce_utf8()){
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 7,
.userptr = nullptr,
@ -220,7 +220,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutTransPlanar") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 10,
.userptr = nullptr,
@ -248,7 +248,7 @@ TEST_CASE("TextLayout") {
if(enforce_utf8()){
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 10,
.userptr = nullptr,
@ -274,7 +274,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutLeadingSpaces") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 18,
.userptr = nullptr,
@ -300,7 +300,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutFills1DPlane") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 15,
.userptr = nullptr,
@ -326,7 +326,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutFills1DPlaneWords") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 17,
.userptr = nullptr,
@ -352,7 +352,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutFillsSingleLine") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 13,
.userptr = nullptr,
@ -378,7 +378,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutFillsPlane") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 14,
.userptr = nullptr,
@ -404,7 +404,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutFillsPlaneNoSpaces") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 6,
.userptr = nullptr,
@ -431,7 +431,7 @@ TEST_CASE("TextLayout") {
if(enforce_utf8()){
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 7,
.userptr = nullptr,
@ -459,7 +459,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutLongNoScroll") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 14,
.userptr = nullptr,
@ -485,7 +485,7 @@ TEST_CASE("TextLayout") {
SUBCASE("LayoutLongScroll") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 13,
.userptr = nullptr,
@ -519,7 +519,7 @@ TEST_CASE("TextLayout") {
"sollicitudin dolor, eget elementum dolor. Quisque lobortis sagittis.";
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = READER_ROWS,
.cols = READER_COLS,
.userptr = nullptr,
@ -553,7 +553,7 @@ TEST_CASE("TextLayout") {
"Widgets can be controlled with the keyboard and/or mouse. They are implemented atop ncplanes, and these planes can be manipulated like all others.";
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = READER_ROWS,
.cols = READER_COLS,
.userptr = nullptr,
@ -590,7 +590,7 @@ TEST_CASE("TextLayout") {
"Widgets can be controlled with the keyboard and/or mouse. They are implemented atop ncplanes, and these planes can be manipulated like all others.";
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = READER_ROWS,
.cols = READER_COLS,
.userptr = nullptr,

View File

@ -375,7 +375,7 @@ TEST_CASE("NCPlane") {
notcurses_term_dim_yx(nc_, &y, &x);
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = y,
.cols = x,
.userptr = sentinel,
@ -399,7 +399,7 @@ TEST_CASE("NCPlane") {
notcurses_term_dim_yx(nc_, &y, &x);
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = y,
.cols = x,
nullptr, nullptr, nullptr, 0,
@ -423,7 +423,7 @@ TEST_CASE("NCPlane") {
notcurses_term_dim_yx(nc_, &maxy, &maxx);
struct ncplane_options nopts = {
.y = y,
.horiz = { .x = x, },
.x = x,
.rows = maxy,
.cols = maxx,
nullptr, nullptr, nullptr, 0,
@ -469,7 +469,7 @@ TEST_CASE("NCPlane") {
y = dimy / 2 - 1;
struct ncplane_options nopts = {
.y = y,
.horiz = { .x = x, },
.x = x,
.rows = maxy,
.cols = maxx,
nullptr, nullptr, nullptr, 0,
@ -711,7 +711,7 @@ TEST_CASE("NCPlane") {
ncplane_yx(n_, &y, &x);
struct ncplane_options nopts = {
.y = y,
.horiz = { .x = ncols - 3, },
.x = ncols - 3,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -732,7 +732,7 @@ TEST_CASE("NCPlane") {
ncplane_yx(n_, &y, &x);
struct ncplane_options nopts = {
.y = y,
.horiz = { .x = x, },
.x = x,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -786,7 +786,7 @@ TEST_CASE("NCPlane") {
notcurses_stddim_yx(nc_, &dimy, &dimx);
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -815,7 +815,7 @@ TEST_CASE("NCPlane") {
SUBCASE("BoundPlaneMoves") {
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -838,7 +838,7 @@ TEST_CASE("NCPlane") {
SUBCASE("BoundToPlaneMoves") { // bound plane ought move along with plane
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -861,7 +861,7 @@ TEST_CASE("NCPlane") {
SUBCASE("UnboundPlaneMoves") { // unbound plane no longer gets pulled along
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -888,7 +888,7 @@ TEST_CASE("NCPlane") {
SUBCASE("NoReparentStdPlane") {
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,

View File

@ -73,7 +73,7 @@ TEST_CASE("NotcursesBase") {
const auto idx = y * maxx + x;
struct ncplane_options nopts = {
.y = y,
.horiz = { .x = x, },
.x = x,
.rows = 1,
.cols = 1,
.userptr = &planesecrets[idx],

View File

@ -16,7 +16,7 @@ TEST_CASE("Readers") {
ncreader_options opts{};
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = dimy / 2,
.cols = dimx / 2,
.userptr = nullptr,

View File

@ -292,7 +292,7 @@ TEST_CASE("Reels") {
channels_set_bg_alpha(&channels, CELL_ALPHA_TRANSPARENT);
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = dimy,
.cols = dimx,
.userptr = nullptr,

View File

@ -25,7 +25,7 @@ TEST_CASE("Resize") {
int x = dimx;
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0 },
.x = 0,
.rows = y,
.cols = x,
nullptr, nullptr, nullptr, 0,
@ -49,7 +49,7 @@ TEST_CASE("Resize") {
int x = 2;
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0 },
.x = 0,
.rows = y,
.cols = x,
nullptr, nullptr, nullptr, 0,

View File

@ -52,7 +52,7 @@ TEST_CASE("Rotate") {
SUBCASE("RotateTransparentCW") {
struct ncplane_options nopts = {
.y = dimy / 2,
.horiz = { .x = dimx / 2, },
.x = dimx / 2,
.rows = 8,
.cols = 16,
.userptr = nullptr,
@ -86,7 +86,7 @@ TEST_CASE("Rotate") {
// should be a square, and should remain a square through rotations
struct ncplane_options nopts = {
.y = dimy / 2,
.horiz = { .x = dimx / 2, },
.x = dimx / 2,
.rows = 8,
.cols = 16,
.userptr = nullptr,
@ -104,7 +104,7 @@ TEST_CASE("Rotate") {
// should be a square, and should remain a square through rotations
struct ncplane_options nopts = {
.y = dimy / 2,
.horiz = { .x = dimx / 2, },
.x = dimx / 2,
.rows = 8,
.cols = 32,
.userptr = nullptr,
@ -122,7 +122,7 @@ TEST_CASE("Rotate") {
// should be a square, and should remain a square through rotations
struct ncplane_options nopts = {
.y = dimy / 2,
.horiz = { .x = dimx / 2, },
.x = dimx / 2,
.rows = 8,
.cols = 16,
.userptr = nullptr,
@ -140,7 +140,7 @@ TEST_CASE("Rotate") {
// should be a square, and should remain a square through rotations
struct ncplane_options nopts = {
.y = dimy / 2,
.horiz = { .x = dimx / 2, },
.x = dimx / 2,
.rows = 8,
.cols = 32,
.userptr = nullptr,

View File

@ -21,7 +21,7 @@ TEST_CASE("Scrolling") {
SUBCASE("ScrollingStr") {
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 20,
nullptr, nullptr, nullptr, 0,
@ -50,7 +50,7 @@ TEST_CASE("Scrolling") {
SUBCASE("NoScrollingManually") {
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 20,
nullptr, nullptr, nullptr, 0,
@ -71,7 +71,7 @@ TEST_CASE("Scrolling") {
SUBCASE("ScrollingSplitStr") {
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 20,
nullptr, nullptr, nullptr, 0,
@ -98,7 +98,7 @@ TEST_CASE("Scrolling") {
const char* out = "0123456789012345678901234567890123456789";
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 20,
nullptr, nullptr, nullptr, 0,
@ -137,7 +137,7 @@ TEST_CASE("Scrolling") {
SUBCASE("ScrollingBoxen") {
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 4,
.cols = 20,
nullptr, nullptr, nullptr, 0,
@ -161,7 +161,7 @@ TEST_CASE("Scrolling") {
const char* next2 = "UVWXYZabcd";
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 20,
nullptr, nullptr, nullptr, 0,
@ -221,7 +221,7 @@ TEST_CASE("Scrolling") {
CHECK(0 == notcurses_render(nc_));
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 2,
.cols = 20,
nullptr, nullptr, nullptr, 0,

View File

@ -15,7 +15,7 @@ TEST_CASE("Selectors") {
struct ncselector_options opts{};
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,
@ -39,7 +39,7 @@ TEST_CASE("Selectors") {
opts.title = strdup("hey hey whaddya say");
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,
@ -62,7 +62,7 @@ TEST_CASE("Selectors") {
opts.secondary = strdup("this is not a title, but it's not *not* a title");
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,
@ -85,7 +85,7 @@ TEST_CASE("Selectors") {
opts.footer = strdup("i am a lone footer, little old footer");
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,
@ -114,7 +114,7 @@ TEST_CASE("Selectors") {
opts.items = items;
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,
@ -136,7 +136,7 @@ TEST_CASE("Selectors") {
struct ncselector_options opts{};
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,
@ -167,7 +167,7 @@ TEST_CASE("Selectors") {
opts.items = items;
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,
@ -213,7 +213,7 @@ TEST_CASE("Selectors") {
opts.items = items;
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,
@ -264,7 +264,7 @@ TEST_CASE("Selectors") {
opts.items = items;
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,

View File

@ -224,7 +224,7 @@ TEST_CASE("Wide") {
SUBCASE("BoxedWideGlyph") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 4,
.userptr = nullptr,
@ -348,7 +348,7 @@ TEST_CASE("Wide") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 1, },
.x = 1,
.rows = 1,
.cols = 2,
.userptr = nullptr,
@ -395,7 +395,7 @@ TEST_CASE("Wide") {
SUBCASE("OverWide") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 3,
.cols = 4,
.userptr = nullptr,
@ -444,7 +444,7 @@ TEST_CASE("Wide") {
// start the 1x4 top plane at 0, 4
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 4, },
.x = 4,
.rows = 1,
.cols = 4,
.userptr = nullptr,
@ -628,7 +628,7 @@ TEST_CASE("Wide") {
// start the 1x4 top plane at 0, 4
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 4, },
.x = 4,
.rows = 1,
.cols = 4,
.userptr = nullptr,
@ -783,7 +783,7 @@ TEST_CASE("Wide") {
// start the 1x4 top plane at 0, 4
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 4, },
.x = 4,
.rows = 1,
.cols = 4,
.userptr = nullptr,
@ -977,7 +977,7 @@ TEST_CASE("Wide") {
SUBCASE("HigherGlyphAbides") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 1,
.cols = 1,
.userptr = nullptr,

View File

@ -28,7 +28,7 @@ TEST_CASE("ZAxis") {
SUBCASE("NoMoveSelf") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -45,7 +45,7 @@ TEST_CASE("ZAxis") {
SUBCASE("NewPlaneOnTop") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -62,7 +62,7 @@ TEST_CASE("ZAxis") {
SUBCASE("TopToTop") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -85,7 +85,7 @@ TEST_CASE("ZAxis") {
SUBCASE("TopToBottom") {
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -117,7 +117,7 @@ TEST_CASE("ZAxis") {
REQUIRE(0 == strcmp("x", cell_extended_gcluster(n_, &c)));
struct ncplane_options nopts = {
.y = 0,
.horiz = { .x = 0, },
.x = 0,
.rows = 2,
.cols = 2,
nullptr, nullptr, nullptr, 0,
@ -148,7 +148,7 @@ TEST_CASE("ZAxis") {
SUBCASE("DropPlanes") {
struct ncplane_options nopts = {
.y = 1,
.horiz = { .x = 1, },
.x = 1,
.rows = 1,
.cols = 1,
nullptr, nullptr, nullptr, 0,